Sample Header Ad - 728x90

How to assign matching node values from xmlstarlet to an array in bash?

1 vote
1 answer
92 views
The loop below finds all of the nodes where the value equals "DOWNLOADING" and grabs the value of the corresponding "bytesdownloaded" node. I was expecting adlBytesDL1 to equal 147333120 (from the first matched node); instead, it equals 147333120147329024 (node1 and node2 back to back). I assume I am putting my index in the wrong place, but I cannot figure out where it belongs. Any help is greatly appreciated. I have to use XMLSTARLET with Xpath 1.0. for ((i=0; i 2284879 InProgress true Sun, 30 Jun 2024 14:48:39 +0000 2284879 1 cefbabced653b2837ccd4bd906841390b1f87227 1869565324 http://servername.com/A13_13.26.9U3.zip DOWNLOADING Sun, 30 Jun 2024 14:48:39 +0000 0 false 147333120 1869565324 5 2284879 2 7e90e741c6ffd3476bdbae0262ff5a6aad49b925 1877973677 http://servername.com/A13_13.29.10U0.zip DOWNLOADING Sun, 30 Jun 2024 14:48:39 +0000 0 false 147329024 1877973677 5 ```
Asked by webbytr (13 rep)
Aug 5, 2024, 08:54 PM
Last activity: Aug 6, 2024, 05:47 AM