I have the following command:
cat PathFiles.txt | xargs xml sel -T -t -f -m /XML/Path -v "concat(value1,',',value2)" -n > test.csv
PathFiles.txt contains .xml files
COLORADO.xml
ALASKA.xml
CALIFORNIA.xml
WASHINGTON.xml
OREGON.xml
It will output like so:
#test.csv
COLORADO.xmlvalue1,value2
value1,value2
value1,value2
value1,value2
ALASKA.xmlvalue1,value2
value1,value2
value1,value2
value1,value2
...etc
My issue is COLORADO.xmlvalue1,value2
ALASKA.xmlvalue1,value2
when I need it to be
COLORADO.xml
value1,value2
value1,value2
value1,value2
value1,value2
ALASKA.xml
value1,value2
value1,value2
value1,value2
value1,value2
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. Is this possible? Should I look into possibly outputting to .txt and the using grep or awk to seperate it out?
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 thexml sel
command.
Just put another -n
command after the -f
:
< PathFiles.txt xargs xml sel -T -t -f -n -m /XML/Path -v "concat(value1,',',value2)" -n > test.csv