Welcome

You have reached the blog of Keith Elder. Thank you for visiting! Feel free to click the twitter icon to the right and follow me on twitter.

Search and Replace a string in any file

Posted by Keith Elder | Posted in Linux, Programming | Posted on 16-10-2000

In UNIX environment, the following combination of perl and find will serch for a particular file and replace the occurence of a particular string with another string in that file. This will also work for multiple files and directories. The find command finds the file and the perl script replaces old string with the new one. perl -pi -e 's/old string/new string' `find . -name "file name"`

Write a comment