Skip to content

Instantly share code, notes, and snippets.

@ajbonner
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajbonner/11038267 to your computer and use it in GitHub Desktop.
Save ajbonner/11038267 to your computer and use it in GitHub Desktop.
Mass Rename Files in a Dir Using Sed Expression
#!/usr/bin/env bash
find . -name '*.gz' -print | while read SRC_FILE; do
DEST_FILE=$(echo $SRC_FILE | sed 's/_2014.*.sql.gz/.sql.gz/')
mv $SRC_FILE $DEST_FILE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment