Skip to content

Instantly share code, notes, and snippets.

@uilian
Created April 15, 2019 16:02
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 uilian/e9cbaee167513d0ce256a059f79d5689 to your computer and use it in GitHub Desktop.
Save uilian/e9cbaee167513d0ce256a059f79d5689 to your computer and use it in GitHub Desktop.
Multi-rename files
# Assembles the old and new names, in the following example the name has 3 parts
# The NR adds a linenumber to the new name.
s ls pattern_file_name* | awk '{print "mv " $1"\\ "$2"\\ "$3" " $1 NR $3 }' | bash $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment