Skip to content

Instantly share code, notes, and snippets.

@anish749
Created August 7, 2017 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anish749/1c1fa6d6f487004b5fc0d1770620df81 to your computer and use it in GitHub Desktop.
Save anish749/1c1fa6d6f487004b5fc0d1770620df81 to your computer and use it in GitHub Desktop.
Recursive find and replace using sed in Mac OS X
find . -type f -name '*.java' -exec sed -i '' 's/find/replace/g' {} +
# Find files (type f)
# with name *.java
# execute sed -i (inplace)
# '' means no backup files to be created
# 's/find/replace/g' sed command to do actual replace
# {} + the output of the find command is concatanated and fed to sed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment