Created
May 8, 2013 21:50
-
-
Save gubatron/5543946 to your computer and use it in GitHub Desktop.
Fixing all the license headers in code recursively, changing "FrostWire(TM)" to "FrostWire(R)" in bash
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
#first find the files that need to be changed, and output their paths to a text file | |
#I use 'cut', to trim the ":" left by the grep output. | |
grep "FrostWire(TM)" * -R | awk {'print $1'} | cut -d ":" -f 1 > tm_replace | |
#then go through each file path in the text file and perform a search and replace using perl regex | |
for FILE in `cat tm_replace`; do perl -p -i -e 's/FrostWire\(TM\)/FrostWire\(R\)/g' $FILE; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can replace the whole first line (grep command) with
grep -l > tm_replace
You could skip it altogether if you don't need to preserve timestamps of files. Just run sed or Perl on all files. They would change only matching files anyway. Otherwise you scan all matching files twice.