I am writing a shell script on Ubuntu and use the
sed command to replace all occurences of TOREPLACE
with a newline \n.
sed 's/TOREPLACE/\n/g' /home/user/source.txt
This works great but what I actually want to do is
to assign the output from above to a variable:
TTT=$(sed 's/TOREPLACE/\n/g' /home/user/source.txt)
echo $TTT
echo $TTT does not deliver the expected output… when I try to replace
TOREPLACE with an other string everything works fine.
When I redirect sed to a file all newline replacements work too.
Whats wrong with the variable assignment above?
should work fine as well.