I have a certain php code comment that appears in about 75 files across several users. This command succsessfully locates it. (I didn't bother looking for the double slashes because I wasn't sure about escaping them and they really don't matter for this match.)
grep -l -r "calls the myfunc() function" /home/*/public_html
After I find it, I need to add a line break and some more php code like
if($my_return_var===false){echo "<b>THERE WAS AN ERROR</b>";}
I also need to do similar, like
grep -l -r "include('path/to/my/file.php')" /home/*/public_html
and then insert BEFORE it
"$my_return_var="
Searching Google, I found that grep piped to sed is probably the way to go, but I'm not sure of the syntax.
Can anyone help? By the way, this q/a is probably close, but still a little over my head. How to replace a text string in multiple files in Linux