문제

I'd like to recursively find every "foo.xml" file and on each foo.xml apply the xslt bar.xsl and save over the original foo.xml. When I run the following commands, separately, they work.

find . -name foo.xml
xsltproc -o foo.xml bar.xsl foo.xml

But, when I pipe them, nothing happens to foo.xml.

find . -name foo.xml | xargs xsltproc -o foo.xml bar.xsl
도움이 되었습니까?

해결책

Warning both of these will obviously overwrite the xml's with the transformation as asked in the question.

With you want to do something like

find . -name foo.xml -print0 | xargs -I {} -0 xsltproc -o {} transform.xsl {}

Or with -exec

find . -name foo.xml -exec  xsltproc -o {} transform.xsl {} \;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top