troubleshooting Question

How to search and replace text within all UNIX files, filenames and directories (AIX 5.2)

Avatar of cbetter
cbetter asked on
Unix OS
1 Comment1 Solution2740 ViewsLast Modified:
I want to search thru every directory. filename and file, looking for a particular text (let's say we're looking for RECO).  Then, when RECO (either upper or lower case)  is found within the body of a file, I want to first make a copy of  that file,  to the same directory, with another extension added to the filename (original_name.txt.orig) and then replace RECO (within the original file) with UPGRD.  In addition, if there are directories or filenames that have the same text (RECO) in them, I want to write the original  directory name or filename to a file (in order to track what was changed),  then replace the text RECO in the directory or filename with UPGRD. I'm using UNIX on AIX 5.2.  I'm just coming back to using UNIX and I'm not quite to par with scripting.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
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 1 Comment.
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