I have to rename multiple files in directory by removing first 5 characters for each filename.
How can I do this i bash/shell? I'm using Ubuntu 11.10. Thanks.
Bash – How to rename multiple files by removing characters in bash
bashrename
Related Topic
- Bash – BSD – Remove non-ascii characters from all files in a directory recursively
- Batch file code to find and rename all files ending in a space
- Bash – Recursively rename files using find and sed
- Linux – How to bulk rename files to remove an extraneous space from before the extension
- Linux – how to rename a remote file on linux with script
- Windows – Batch rename removing second letter in filename
- Bash – Batch rename files that end in a dot
Best Answer
A simple for loop with a bit of
sed
will do the trick:The substitute regex in
sed
says to match any five characters (.
means any character) at the start of the string (^
) and remove it.