Skip to content

Instantly share code, notes, and snippets.

@d0minicw0ng
Created January 19, 2015 06:38
Show Gist options
  • Save d0minicw0ng/f878e7d6be6560236eb2 to your computer and use it in GitHub Desktop.
Save d0minicw0ng/f878e7d6be6560236eb2 to your computer and use it in GitHub Desktop.
Shell script for global renaming
# 1. Recursively find all files in the directory with the extension ".js.cofee" and feeds the files into an input stream
# 2. Run `sed` to perform a string replace ('hello' => 'world') and create backup files
# 3. Find all the backup files and remove them recursively from the directory
find . -name "*.js.coffee" | while read a
do
sed -iBACKUP 's/hello/world/' $a
done
find . -name "*BACKUP" -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment