Created
November 24, 2010 21:03
-
-
Save samir/714407 to your computer and use it in GitHub Desktop.
Renaming files in one line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rename files in one line | |
# Util for renaming files with prefix or sufix, removing, modifying, etc | |
# First, list files that will be renamed | |
# In sequence, create the command to rename it (using mv command) | |
# Modify the command swapping the string | |
# Send it to /bin/bash | |
ls *_abc.png | awk '{print("mv "$1" "$1)}' | sed 's/_abc/_def/2' | /bin/bash | |
# Credits: http://hints.macworld.com/article.php?story=20010509130450691 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment