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.

Find this article at: http://www.labnol.org/internet/design/wordpress-unix-replace-text-multiple-files/1128/

web: http://www.labnol.org/ email: amit@labnol.org


If you have a question or suggestion that is not related to the above discussion, please post it in this forum. All comments are moderated.

Add a Comment

required, use real name
required, will not be published
optional, your blog address

« Back to main

Google Custom Search