Skip to content

Instantly share code, notes, and snippets.

@rpietro
Created January 17, 2014 19:06
Show Gist options
  • Save rpietro/8479435 to your computer and use it in GitHub Desktop.
Save rpietro/8479435 to your computer and use it in GitHub Desktop.
useful grep commands

to recursively find a string in multiple files under a directory

grep -R 'string' directory

to recursively find a string in multiple files under a directory and then replace the string with something else

grep -R 'string1' directory | xargs sed -i 's/string1/string2/g'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment