Saturday, December 8, 2018

How to replace a string in multiple files from linux command line

find ./ -type f -exec sed -i 's/findstring/replacestring/g' {} \;

For global case insensitive:
find ./ -type f -exec sed -i 's/findstring/replacestring/gI' {} \;

or

cd /path/to/your/folder
sed -i 's/findstring/replacestring/g' *

No comments:

Post a Comment