The following command replaces every occurence of the word
from in any file of the current directory or its subdirectories with
ack-grep -l --print0 --text from | xargs -0 -n 1 sed -i -e 's/from/to/g'
I got that from this thread.
How do I replace a string including multiple words instead of one word? E.g. replace
laughing babies by
smiling little children.
I tried the following but these did not work:
ack-grep -l --print0 --text 'laughing babies' | xargs -0 -n 1 sed -i -e "s/'laughing babies'/'smiling little children'/g" ack-grep -l --print0 --text 'laughing babies' | xargs -0 -n 1 sed -i -e 's/"laughing babies"/"smiling little children"/g'
Don't know if it matters but I'm on