Reputation: 851
I would like to output a file's contents appended with a string without creating a new line.
so far my command places the appended string on a new line:
sed -e 'a foo' file.txt
>> file contents...
>> foo
I want the output to look like this:
>> file contents...foo
Upvotes: 3
Views: 7794
Reputation: 185790
With sed
(tested successfully on Archlinux
& Minix
):
sed '$s/$/foo/' file.txt
$
at the beginning, mean end of file.
If you need to add foo on each lines :
sed 's/$/foo/' file.txt
In the latest context, $
mean end of line
Upvotes: 6