How to search and replace a string in multiple files in linux
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' {} \;
Ignoring .git directory:
find . -not -path '*/\.git/*' -name '*.rb' -exec sed -i 's/old_string/new_string/g' '{}' \;
0 Comments
Please log in to leave a comment.