Friday, August 27, 2010

Change content in files and rename the file names

There exist several configuration files with different filename and tiny change of content. The following script file works for this purpose.


for file in `ls oldfilenamepart*`
do
#newfile=`echo $file | tr '1' '2'`
newfile=`echo $file | sed 's/old/new/'`
#echo $newfile
sed 's/oldcontent/newcontent/g' $file > $newfile
done

No comments:

Post a Comment