sed "/$titlesearch/d" movielist
will delete any line in the file movielist that matches $titlesearch, but this is only a screen print correct ?
how can I have sed to actually delete the line from the file so that it doesnt appear next time I open the file ?
thanks
Steffen
(echo "g/${titlesearch}/d"; echo 'wq') | ex -s movielist
thanks,
you mind explaining your code for me, since I am not quite sure what it does
thanks a lot
Steffen
it feeds 2 lines into the 'ex' utility:
# this line does the 'delete'
"g/${titlesearch}/d"
AND
# this line 'Writes' the file to disk and 'Quits' editing the file
'wq'
'man ex' for more options
anbu23
6
sed "/$titlesearch/d" movielist >tmp
mv tmp movielist
anbu23
8
you can also do that by using perl
perl -i.old -ne "print unless /$titlesearch/" movielist
ranga27
9
Hi
I have a similar Sitiuation .. i found a string i deleted the line by using
sed /coasys11/d man.txt > man5.txt
But i also wanted to delete 6 lines which is above and 5 lines which are below ??
can anyone help me on this