I have a very simple text file here with the following contents
I want to modify the contents via sed(or some other app) so it becomes
So I tried
sed -e "s/line2/line2\\n#this line was added by sed/" my-text-file-here.txt
but the output is
Any ideas on how to do it correctly? I'm using default shell. Thank you
Code:
line1
line2
line3
line4
I want to modify the contents via sed(or some other app) so it becomes
Code:
line1
line2
#this line was added by sed
line3
line4
So I tried
sed -e "s/line2/line2\\n#this line was added by sed/" my-text-file-here.txt
but the output is
Code:
line1
line2\n#this line was added by sed
line3
line4
Any ideas on how to do it correctly? I'm using default shell. Thank you