I get...">

Xmlstarlet sel prints a new line between values

I have the following XML

<process id="test"> </process> <process id="test2"> </process> 

I get the correct values ​​from the attributes, but I want them to be separated by a new line for further processing.

When using the command

 xmlstarlet sel -t -v "count(process/@id" "example.xml)" 

I see that they are separated because it returns 2

The command used to retrieve the attributes is as follows

 xmlstarlet sel -t -v "process/@id" "example.xml" 

Question:

Is it possible to return the result with a new line for each attribute? If this were not done using xmllint?

+7
source share
1 answer

I looked at this for 2 days and I found the following page:

http://www.geekfarm.org/wu/muse/XmlStarlet.html

It helped me a lot.

I used the following command to achieve line breaks

 xmlstarlet sel -t -m "process" -n -v "@id" "example.xml" 
+10
source

All Articles