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 file开发者_如何学编程s in my directory.
any pointers will be great.
thanks,
novice
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'
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 ...
精彩评论