[英]Error when converting XML to CSV in command line
I am trying to find all .xml
file in a Linux directory and convert them to .csv
by:我试图在 Linux 目录中找到所有
.xml
文件,并将它们转换为.csv
:
find . -name "*xml" -execdir sh -c 'xsltproc -o "${0%.xml}.csv" opv.xsl "$0"' {} \;
but the following error occurred:但出现以下错误:
warning: failed to load external entity "opv.xsl"
cannot parse opv.xsl
I have already installed the xsltproc
package by conda install -c anaconda libxslt
.我已经通过 conda
conda install -c anaconda libxslt
安装了xsltproc
package 。
I believe you want to use -exec
rather than -execdir
.我相信您想使用
-exec
而不是-execdir
。 The difference is that -execdir
executes the command in the directory containing each found file, but those directories won't contain your stylesheet.不同之处在于
-execdir
在包含每个找到的文件的目录中执行命令,但这些目录不会包含您的样式表。 Alternatively, provide a full path to the stylesheet file.或者,提供样式表文件的完整路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.