Nullpoet
Nullpoet

Reputation: 11259

Bash scripting : How do I rename files to remove numeric characters at the beginning?

mv command doesnt accept pattern matching like grep !
Whats the good way to handle this and similar kind of operations ?

Upvotes: 2

Views: 365

Answers (1)

Daenyth
Daenyth

Reputation: 37441

There's the rename tool, but if that's not what you want, you can do:

for file in *; do
    new_file="${file##[0-9]}" # Strip all leading numbers
    mv "$file" "$newfile"
done

Upvotes: 2

Related Questions