Hi,
I'm trying to rename all the files with .zip extention that are in the current directory. I need to remove first 8 characters from the filename, so NEWFN=OLDFN minus first 8 characters.
I'm trying this:
ls *.zip | while read a b
do
OLDFN=$a
NEWFN=`awk '{ print ( substr ($a,8,35) ) }'`
echo "mv $OLDFN to $NEWFN"
done
what I see is only the new file name, so the awk output.
I know I'm missing something, but what?
Thanks in advance.
I'm trying to rename all the files with .zip extention that are in the current directory. I need to remove first 8 characters from the filename, so NEWFN=OLDFN minus first 8 characters.
I'm trying this:
ls *.zip | while read a b
do
OLDFN=$a
NEWFN=`awk '{ print ( substr ($a,8,35) ) }'`
echo "mv $OLDFN to $NEWFN"
done
what I see is only the new file name, so the awk output.
I know I'm missing something, but what?
Thanks in advance.