Operating System - Linux
1825951 Members
3037 Online
109690 Solutions
New Discussion

Changing text in all files in a dir

 
SOLVED
Go to solution
P-Dicky
Frequent Advisor

Changing text in all files in a dir

Hello

I need to change this "$LOG" to "/path/path/path" in all files in dir full of ascii files. Any tips?

Thanks
2 REPLIES 2
James R. Ferguson
Acclaimed Contributor
Solution

Re: Changing text in all files in a dir

Hi:

A rapid way is:

# cd /path && find . -xdev -type f -exec perl -pi -e 's{\$LOG}{/path/path/path}g' {} +

This will update the files "inplace".

Regards!

...JRF...
P-Dicky
Frequent Advisor

Re: Changing text in all files in a dir

Perfect!

Thank you James