and now I need to replace something like {} with {comment} at $line2insert.
The line actually is :
.appdata {}
and no identifier can be added to use it for search and substitution. Of course, appdata and {} are already used as well in several locations. Therefore, I really need to use the line number.
Thanks a lot !!!
This works perfectly as expected.
Is there as well such a single sed command to remove several lines starting from my "label" line after all ?
May be something like : sed '/label/{d.....n;d...}' < filein > fileout ; mv fileout filein
this was just to finalize my need...
I was wondering if in a single sed command it would be possible to remove several lines starting from my label :
the following :
sed '/label/{N;N;d;}' < input > output
is only removing the second line after label, isn't it ?
But if I want to remove in one shot several lines, having only my label as reference, how should I write my sed command ?
In fact, I would like to replace the 3 lines described in my previous post :
sed '/labe/{n;n;d;}' < filein > fileout; mv fileout filein
sed '/label/{n;d;}' < filein > fileout; mv fileout filein
sed '/label/d' < filein > fileout; mv fileout filein
with only one.:rolleyes: