Hello All;
I am trying to insert about 4 lines after a specific sentence in the file. This sentence may not necessarily be on the same line in the file every time. How would I do this? I tried using a sed but it didn't print out the new lines.
I want for example:
Harry is
To become:
Harry is
no pleased
as he
cannot see
the...
This is how I tried it using sed:
infile="harry.txt"
sed -e 'sHarry is!Harry is\nno pleased\nas he\ncannot see\nthe...!g' $infile.$$ >$infile && rm $infile.$$
But this printed the following:
Harry isnno pleasednas hencannot seenthe...
I tried double slashing but that just printed:
Harry is\nno pleased\nas he\ncannot see\nthe...
Any ideas how to do this, maybe recommendations of a different method?
Any and all help greatly appreciated.
Sean.![[peace] [peace] [peace]](/data/assets/smilies/peace.gif)
I am trying to insert about 4 lines after a specific sentence in the file. This sentence may not necessarily be on the same line in the file every time. How would I do this? I tried using a sed but it didn't print out the new lines.
I want for example:
Harry is
To become:
Harry is
no pleased
as he
cannot see
the...
This is how I tried it using sed:
infile="harry.txt"
sed -e 'sHarry is!Harry is\nno pleased\nas he\ncannot see\nthe...!g' $infile.$$ >$infile && rm $infile.$$
But this printed the following:
Harry isnno pleasednas hencannot seenthe...
I tried double slashing but that just printed:
Harry is\nno pleased\nas he\ncannot see\nthe...
Any ideas how to do this, maybe recommendations of a different method?
Any and all help greatly appreciated.
Sean.
![[peace] [peace] [peace]](/data/assets/smilies/peace.gif)