Follow us on Facebook

How to Change Text Inside Multiple Files in Unix

I recently moved my feed from feeds.feedburner.com/labnol to feeds.labnol.org/labnol and so had to change the <link> tag inside all HTML documents to reflect the change.

One of the options was to do a vi *.html and replace text manually but here’s a simple solution:

sed -e 's/old-address/new-address/' -i *.html

If you want to replace text in just a couple of files, replace with the wildcard character with the name of the files.
Share on Google Plus

About Naresh Sahu

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Blog Archive

Ads