[nycphp-talk] deep dish 's/searchstr/replacestr/g'
pswebcode, nyc
psaw at pswebcode.com
Fri Jul 18 10:15:12 EDT 2003
find . -type f -exec fgrep -li 'searchstr' {} > outputfile \;
Search for searchstr in all files of type file
Starts in dir where executed, recursively does all subdirs
Writes all file names that contain searchstr into a file
find . -name "*.htm" |xargs perl -i.bak -p -e 's/searchstr/replacestr/g';
Search and replace only in files of type specified
Starts in dir where executed, recursively does all subdirs
Before replace, backs up original file, appending extension .bak
PERL edits in place, no file permission issues with newly modified file
UNIX/PERL bits useful to me
Maybe you too
Your box === PERL installed
Warmest regards,
Peter Sawczynec, Technology Director
PSWebcode -- Web Development and
Site Architecture
psaw at pswebcode.com
www.pswebcode.com
718.543.3240
More information about the talk
mailing list