I have made a list of files of which I want to remove strings beginning with <iframe and </iframe
When I run the script I see the files fly along and the strings being removed.
However, in the source files nothing has changed.
Do I really need to write sed's result to a different output file... or can this be done inside the original file itself?
Thanks, Alge
#!/bin/bash
while read line; do
sed -e '/<iframe[^>]>/d'; -e '/<\/iframe[^>]>/d' < $line
done < /root/allsites-com-3.txt
you can use the -i option to do inline proccessing of the file(s). Also, if you add an ext to -i ie: -i.bak your ariginal file will be preserved with a .bak extension
Thanks guys.
Scrutinizer, you 've got a sharp eye!
I started my tests without the semicolon (like the one you showed; I just added the semicolon later.
But also without the semicolon the line which contains the iframe won't get deleted. I then tested it with one file at a time and yes, then it works....
I am ging to try Sweetblood's suggestion to work with the -i option for removing the line "in-file".