I had a bunch of html files where a particular style sheet inclusion had to be removed from about 500 odd html files.
Knew this could be done through an sed script , but found a better one using perl from here.
export OLD_TEXT='<link rel=”stylesheet” type=”text/css” href=”style.css”>’
export NEW_TEXT=’some new text’
and use it in the perl command as follows.
perl -w -i -p -e “s/$OLD_TEXT/$NEW_TEXT/g” *.html
or use it against all .html files from the current directory using find and xargs
find . -name “*.html” | xargs -i perl -w -i -p -e “s/$OLD_TEXT/$NEW_TEXT/g” {}
Hello,
It’s nice tutorial. It’s good to share from you. It will help a lot to search text from multiple files.
Thanks for sharing it….
Regards,
Mihir
ask4itsolutions.com