Skip to content

Instantly share code, notes, and snippets.

@cmfcmf
Created August 31, 2013 07:58
Show Gist options
  • Save cmfcmf/6396836 to your computer and use it in GitHub Desktop.
Save cmfcmf/6396836 to your computer and use it in GitHub Desktop.
Linux Search And Replace Source: http://stackoverflow.com/a/8588807/2560557

For the file file.txt:

sed -i 's/abc/abcd/g' file.txt

For all files in the current folder:

find . -maxdepth 1 -type f -exec sed -i 's/abc/abcd/g' {} \;

For the files in the current directory and all subdirectories:

find . -type f -exec sed -i 's/abc/abcd/g' {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment