A command to replace all occurances of the word “night” with “day” in all txt files in the folder foo and all of it’s subdirectories

find ~/foo -name “*.txt” | xargs grep -l ‘night’ | xargs -l sed -i -e ‘s/night/day/’

Advertisements