Zet - How do I do a sed replace recursively on all files?

How do I do a sed replace recursively on all files?

For macOS (BSD sed)

On macOS, the -i flag with sed requires an argument for the backup suffix, even if it’s an empty string. Make sure there’s no space between -i and '':

find . -type f -exec sed -i '' 's/primary/partition/g' {} +

For GNU sed (Linux)

On Linux with GNU sed, you don’t need to provide an empty string after -i:

find . -type f -exec sed -i 's/primary/partition/g' {} +
You can use /pattern/d to delete a whole line like vim g:pattern/d Note the lack of s on /pattern/d

#bash #sed