Wednesday, September 19, 2007

Using Awk to rename multiple files

The following awk script will rename files named like:

_TEST.ABC.123.XML.1231123

to the following

TEST.ABC.123.XML


for f in `ls _TEST*`
do
newfile=`echo $f | grep -o TEST.[A-Z]*.[0-9]*.XML`
mv $f $newfile
done

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home