I am trying to append and prepend text to every line in a .txt file.
I want to prepend: I am a
I want to append:
128... [}
to every line.
Inside of a.txt:
fruit, like
bike, like
dino, like
Upon performing the following command:
$ cat a.txt|sed 'I am a ',' 128... [}'
it does not work how I want it to. I would really want it to say the following:
I am a fruit, like 128... [}
I am a bike, like 128... [}
I am a dino, like 128... [}
sed 's/^/^.{128} /; s/$/$/'
I want to add^.{128}
to the beginning and$
to the end. – Terkey-Juice Mar 31 '18 at 05:26^
. And I always keep backups of things. Always. Thank you friend – Terkey-Juice Mar 31 '18 at 06:12awk
solution would be faster? – Terkey-Juice Apr 01 '18 at 03:39" "
rather than single quotes' '
. This would change the functionality of the$
operator. If you also want variable substitution, use the following method:
– azizbro Jul 02 '20 at 02:21sed "s/.*/${var1}&${var2}/"