I use my Linux terminal to do it. I simply use
grep to find things in files, and then I use
sed to go through the file and replace whatever I want.
Say I have a ton of PHP files, and I wanted to find a single word or sequence of words.
grep -r -i -l "keyword" *.php
The * is a wild card. It represents what to look for. It my example it looks for anything ending with .php You can put things before the * and it will look for anything starting with what you specify and ending in anything One example would be hidden files. Hidden files start with a period so I could do.
grep -r -i -l "keyword" .*
-r recursive (will search folder and subfolders)
-i case insensitive (ignores UPPERCASE or lowercase)
-l list only (displays names of files found only)
to find and replace
grep -rl 'this' /some_directory/ | xargs sed -i 's/this/that/g'
The above line would replace all instances of 'this' with 'that'
This is one huge reason I really like Linux. There are so many regex options to use with the
You can replace all lower case instance to upper case, replaces spaces with underscores, etc. All using one line.
You can build long complicated regexes to do all kinds of things.
Last edited by stevenmw; 12-05-2012 at 04:26 PM..