how to append to an existing line using sed
scripting, sed, unix
Solution
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
Problem
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 ```