troubleshooting Question

unix find and replace recursively

Avatar of n00b0101
n00b0101 asked on
Unix OSLinuxLinux Distributions
6 Comments1 Solution625 ViewsLast Modified:
Hopefully, this will be a quick one for someone here... I need to find and replace a string recursively in unix.  

Normally, I use:

   perl -e "s/term/differenterm/g;" -pi $(find path/to/DIRECTORY -type f)

But, the string I need to replace contains slashes, and I'm not sure how to escape them?

So, I need to do:

    perl -e "s/FIND/REPLACE/g;" -pi $(find path/to/DIRECTORY -type f)
where FIND = '/string/path/term'
and REPLACE = '/string/path/newterm'
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros