The unix script to remove all file name prefix of 2 digits. example :
03 What is this about.txt
for name in [0-9][0-9]*
do
newname="$(echo "$name" | cut -c4-)"
mv "$name" "$newname"
echo ${newname}
done
This uses bash command substitution to remove the first 3 characters from the input filename via
cut, and stores that in $newname. Then it renames the old name to the new name. This is performed on every file.cut -c4- specifies that only characters after index 4 should be returned from the input. 4- is a range starting at index 7 with no end; that is, until the end of the line.Reference:
http://unix.stackexchange.com/questions/47367/bulk-rename-change-prefix
No comments:
Post a Comment