
Untitled
By: a guest on
Jul 4th, 2012 | syntax:
None | size: 0.57 KB | hits: 5 | expires: Never
# Usage
# (Note: This command does not handle spaces in filenames!)
# * cd into the directory containing the files and subdirectories of files in
# which you wish to carry out string substitution using a regex
# * Run the command:
# rsub 'search regex' 'replacement text'
# * This will effect the desired substitution in files in the current directory
# and in any subdirectories
# Explaination
# * The -I {} allows you to grab each thing that xargs iterates over
# as {}
# * So {} is probably the most important thing
#
egrep -rl "$1" .|xargs -I {} sed -i "s/$1/$2/g" {}