Created
January 19, 2015 06:38
-
-
Save d0minicw0ng/f878e7d6be6560236eb2 to your computer and use it in GitHub Desktop.
Shell script for global renaming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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