A
A
Alexv012015-06-25 07:27:19
linux
Alexv01, 2015-06-25 07:27:19

How to implement grep string search and replace with recursion?

Tell me how to implement a search and replace a string with recursion.
They suggested an option how to do a search
grep -r --include=*.php "some-words" /path
Tell me how to do it now and replace the line with another one.
Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2015-06-25
@saboteur_kiev

find. -name *.php -exec sed -is/pattern/newtext/g {} \;

E
egor_nullptr, 2015-06-25
@egor_nullptr

grep -rln --include=*.php "old-word" /path | xargs [email protected] sed -i 's/old-word/new-word/g' @

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question