🦊

Search and Replace in Text Directories

via mutliple authors on Stackoverflow: Find and replace with sed in directory and sub directories

in BSD

find ./ -type f -exec sed -i -e '' 's/apple/orange/g' {} \;

in GNU

find ./ -type f -exec sed -i -e 's/apple/orange/g' {} \;

faster

grep -rl 'apples' /dir_to_search_under | xargs sed -i 's/apples/oranges/g'

fastest in git repo

git grep -l 'apples' | xargs sed -i 's/apples/oranges/g'

replacing forward slashes?

xargs sed -i 's|mduuid/apples|mduuid/oranges|g'