Skip to content

Instantly share code, notes, and snippets.

@acallaghan
Created March 25, 2013 11:32
Show Gist options
  • Select an option

  • Save acallaghan/5236544 to your computer and use it in GitHub Desktop.

Select an option

Save acallaghan/5236544 to your computer and use it in GitHub Desktop.
Batch rename files with preview
# List all .rb file beginning with v1_ and change too bar_*.rb
ls v1_*.rb | awk '{print("mv "$1" "$1)}' | sed 's/v1_/bar_/2'
# The same as above, but commit the changes
ls v1_*.rb | awk '{print("mv "$1" "$1)}' | sed 's/v1_/bar_/2' | /bin/sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment