I want to replace the word willow
with oak
throughout my code.
This change needs to be made to multiple files at different levels.
I have attempted to use the answers from: How to do a recursive find/replace of a string with awk or sed?
Especially,
grep -rl willow . | xargs sed -i -e '' 's/willow/oak/g'
As I am using a Mac (from: sed -i command for in-place editing to work with both GNU sed and BSD/OSX), I have used the extra -e ''
commands. However, I am getting
s/willow/oak/g: No such file or directory
I have also tried:
grep -rl willow . | xargs sed -i '' 's/willow/oak/g'
which (due to the OS) gave: sed: RE error: illegal byte sequence.
How can I recursively go through all the files in different dictionaries on a Mac to replace all instances of willow?