a.txt, a.ps, a.pdfand you want to change the file names to
b.txt, b.ps, b.pdfHere is how to do it.
for file in `ls a.*`
do
mv $file b.${file##*.}
done
basically the ${file##*.} extracts the extensions of the file. On the same note ${file%*.} will extract the first names of the files.
got it from this page :)
No comments:
Post a Comment