for a in *; do b=`echo $a|sed 's/.*\([0-9][0-9]*\).*\(\..*\)$/\1\2/' `; mv "$a" "$b"; doneIn this example, all files are renamed to the first collection of numbers in its original names, while keeping the original postfix. E.g.,
blue4.mp3 -> 4.mp3
11help.dat -> 11.dat
No comments:
Post a Comment