Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wipermail/3068121b4cfe58ba52b9768b40f23012 to your computer and use it in GitHub Desktop.
Save wipermail/3068121b4cfe58ba52b9768b40f23012 to your computer and use it in GitHub Desktop.
How to replace a string in multiple files in linux command line
Similar to Kaspar's answer but with the g flag to replace all the occurrences on a line.
find ./ -type f -exec sed -i 's/old_string/new_string/g' {} \;
For global case insensitive:
find ./ -type f -exec sed -i 's/old_string/new_string/gI' {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment