-Techniques and tricks‎ > ‎Mac OS X‎ > ‎

Command line


Various command line wizardry:

Search and replace text recursively in all files in a directory and its subdirectories:

Use 

find . -type f -name '*.txt' -exec sed -i '' s/this/that/ {} +

This assumes you want to replace 'this' with 'that' in all files with the extension .txt. It is case-sensitive.


Keywords: find/replace folder subfolder subfolders subdirectory




Comments