Right now I'm using
echo "Hello World" >> file.txt
to append some text to a file but I also need to add text below a certain string let's say [option]
, is it possible with sed
?
EG:
Input file
Some text
Random
[option]
Some stuff
Output file
Some text
Random
[option]
*inserted text*
Some stuff
input
and theoutput
lines. Because you Q is unclear. You could also doecho "Hello World [option]" >> file.txt
, but it doesn't make sense.