Skip to content

Instantly share code, notes, and snippets.

@sankars
Last active August 29, 2015 13:55
Show Gist options
  • Select an option

  • Save sankars/8688483 to your computer and use it in GitHub Desktop.

Select an option

Save sankars/8688483 to your computer and use it in GitHub Desktop.
Rename all files having its name or its contents matching the regex in a directory.
for i in *; do new_name=$(echo $i | sed -e 's/1012/1015/g'); sed -i 's/1012/1015/g' $i ; mv $i $new_name; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment