Question

I have 1000 files in a directory. I'm on a solaris machine

I want to replace the string " /example/test/temp " t0 " /testing/in/progress/ in all the xml files in my directory.

any pointers will be great.

thanks,

novice

Was it helpful?

Solution

How about (all on one line):

find . \( -type d ! -name . -prune \) -o \( -type f -name "*.xml" -print \) |
    xargs perl -i.old -p -e 's-/example/test/temp-/testing/in/progress/-g'

OTHER TIPS

Use sed(1).

In general it is safer to use an xslt processor to massage XML files, but in this particular example, the chances of some "funky" XML representation causing problems is pretty remote ...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top