Recursive string change

You want recursive change one string to another, it’s simple, you need a list with full file name path called ‘output_list’, and run command bellow:

cat output_list|while read line;
do
cp -p $line $line.bkp;
cat $line |sed ‘s/SOURCE_STRING/TARGET_STRING/g’ > $line.bkp && mv $line.bkp $line;
done

Keep in mind it’s a DANGEROUS command, double check your file list, and if necessary,  make a full backup from you system.

It will run on UNIX(ES) and Linux.

Maiquel.

One comment

  1. Pingback: Tips to Improve your Oracle DB Shellscripting! – GREPORA

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from grepOra

Subscribe now to keep reading and get access to the full archive.

Continue reading