Find and replace in a codebase

Jun 06, 22

OSX:

rg symbol_to_replace -l | xargs sed -i "" 's/symbol_to_replace/my_shiny_new_symbol/g'

That is all ^^

p.s I believe on Linux you can remove the "" after xargs sed -i, however I have not tested this

p.p.s This assumes that you are using ripgrep. If you are not you can replace rg with grep… and then download ripgrep and start using it instead :hehe