Redirection to a file is very usefull to append a string as a new line to a file, like

echo "foo" >> file.txt
echo "bar" >> file.txt

Result:

foo
bar

But is it also possible to redirect a string to the same line in the file ?

Example:

echo "foo" <redirection-command-for-same-line> file.txt
echo "bar" <redirection-command-for-same-line> file.txt

Result:

foobar
Edit
Report