Following command finds PATTERN and replaces it with REPLACEMENT in all files under directory/path/.
grep -rl PATTERN directory/path/ | xargs sed -i 's/PATTERN/REPLACEMENT/g'
Notes :
-r option of grep does recursive search
-i option of sed edits files in place
g does substitutions in all occurences
Monday, August 21, 2006
Subscribe to:
Post Comments (Atom)
1 comment:
-l option of grep outputs only the name of the file where a pattern is found.
Post a Comment