Last active
April 12, 2016 19:17
-
-
Save cab404/b0c82e26fa695eaaea88ceb0023d1dff to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Simple sed-based file renamer | |
if [[ $1 == "" ]]; then | |
echo "No sed expression specified" | |
exit 0 | |
fi | |
DATA=$(ls -1q); IFS=$'\n'; | |
for A in $DATA; do | |
B=$(echo "$A" | sed -e "$1") | |
if [[ $A != $B ]]; then | |
echo "$A -> $B" | |
mv "$A" "$B" | |
fi | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment