How to grep and use sed to replace words containing string to something else ?

Hi,

I would like to use grep and and sed to replace string to something else .

Eg :

When i use grep, there are 97 result :

root@svr51 [/home/xxx/public_html/akaunting]# grep -lir "ini_set" ./* | wc -l
97

I would like to replace "ini_set" found in those file to "//ini_set" , to comment/disabled that line.

Anybody can help to construct full grep and sed command ?

Please let me know also the location where i should run that command to avoid it to replace file in wrong location.

Thank you.
LVL 2
smksaAsked:
Who is Participating?
 
dfkeConnect With a Mentor Commented:
This does  the trick:

cd /path/to/your/folder

sed -i 's/ini_set/\/\/ini_set/g' ./*

Cheers
0
 
smksaAuthor Commented:
Tq
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.