bemara57
asked on
How do I search and replace text in a batch of files?
In a folder I have about 150 files. I want to search for all instances of header.txt and replace it with header_lu.txt. Is this possible thru the a command? Thanks in advance for all the help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
perl -i -pe 's/header\.txt/ header_lu.txt/g' folder/*
find /path/to/folder | while read fname
do
sed 's/header\.txt/header_lu\.
mv -f $fname.new $fname
done
Cheers!
sunnycoder