recursive search and replace with grep and sed

grep will do a first find and return the matched file names
xargs will pass each file name with its path to sed
and obviously sed will edit inline and replace the contents

grep -rl “oldword” ./  | xargs sed -i  ’s/oldword/newword/’

Comments are closed.