Skip to content

Instantly share code, notes, and snippets.

@lloydroc
Last active June 23, 2016 15:16
Show Gist options
  • Save lloydroc/d4f7e13bfe7211f8d9a416222ecc1327 to your computer and use it in GitHub Desktop.
Save lloydroc/d4f7e13bfe7211f8d9a416222ecc1327 to your computer and use it in GitHub Desktop.
Search Replace Multiple Files
perl -pi -w -e 's/search/replace/g;' $( grep -rl 'search' . )
# Perl arguments
# -e means execute the following line of code.
# -i means edit in-place
# -w write warnings
# -p loop over the input file, printing each line after the script is applied to it.
# Grep Arguments
# r is recursive which defaults to NOT following symbolic links
# l is listing the file names only
# the . is the directory you want to search in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment