使用 xmlstarlet -f 时正确格式化为 .csv

Proper formatting to .csv when using xmlstarlet -f

我有以下命令:

cat PathFiles.txt | xargs xml sel -T -t -f -m /XML/Path -v "concat(value1,',',value2)" -n > test.csv

PathFiles.txt 包含 .xml 个文件

COLORADO.xml
ALASKA.xml
CALIFORNIA.xml
WASHINGTON.xml
OREGON.xml

它会像这样输出:

#test.csv
COLORADO.xmlvalue1,value2
value1,value2
value1,value2
value1,value2
ALASKA.xmlvalue1,value2
value1,value2
value1,value2
value1,value2
...etc 

我的问题是 COLORADO.xmlvalue1,value2 ALASKA.xmlvalue1,value2 当我需要

COLORADO.xml 
value1,value2
value1,value2
value1,value2
value1,value2
ALASKA.xml
value1,value2
value1,value2
value1,value2
value1,value2

引用回 xml sel -f 用于输出文件名,我觉得我需要在我想要分隔的内容之间换行(?)。我试过 -f \n 但没有工作,然后我发现我已经在 xml sel 命令末尾使用了换行符 -n 命令。这可能吗?我是否应该考虑输出到 .txt 并使用 grep 或 awk 将其分开?

Referencing back to the xml sel -f is used to output the filename, I feel like I need a newline(?) between what I want to seperate.. I tried -f \n but that did not work, then I found out that I am already using the newline -n command at the end the xml sel command.

只需在 -f 之后添加另一个 -n 命令:

< PathFiles.txt xargs xml sel -T -t -f -n -m /XML/Path -v "concat(value1,',',value2)" -n > test.csv