Skip to content

Instantly share code, notes, and snippets.

@lussier
Created March 17, 2013 19:16
Show Gist options
  • Select an option

  • Save lussier/5183134 to your computer and use it in GitHub Desktop.

Select an option

Save lussier/5183134 to your computer and use it in GitHub Desktop.
Renames x_y.ext files in y.ext in a given directory.
#!/bin/bash
for filename in ele116/*; do
newFilename=$(echo $filename | \
sed -ne "s/^[^_]\+_//p")
mv $filename $newFilename
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment