How do I get a specific value from an XML file
-
Hi all, as part of my Linux build script for my SBC boards I need to download a very small XML file and parse some data, the download I achieve using wget I show a sample file below
What I need is the url for debarm, as this is all being done in a bash script I can't use c#, anyone here know of a way to achieve this in Linux ? many thanks for reading
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
-
Hi all, as part of my Linux build script for my SBC boards I need to download a very small XML file and parse some data, the download I achieve using wget I show a sample file below
What I need is the url for debarm, as this is all being done in a bash script I can't use c#, anyone here know of a way to achieve this in Linux ? many thanks for reading
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
As long as you know that the XML is on one line grep and sed can do the job. Assuming that the XML is in a file name data.xml:
grep "
Things are a bit more complicated if the XML is broken up over several lines. I'm not aware of an XML shell parser, though maybe something from python or perl might do the trick.
"A little song, a little dance, a little seltzer down your pants"
Chuckles the clown -
Hi all, as part of my Linux build script for my SBC boards I need to download a very small XML file and parse some data, the download I achieve using wget I show a sample file below
What I need is the url for debarm, as this is all being done in a bash script I can't use c#, anyone here know of a way to achieve this in Linux ? many thanks for reading
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
Ignore previous. The better way to do this is with xmllint:
[k5054@localhost]$ xmllint --xpath "string(//debarm/@url)" data.xml
https://downloads.lms-community.org/nightly/logitechmediaserver\_8.5.2~1715233151\_arm.deb
[k5054@localhost]$"A little song, a little dance, a little seltzer down your pants" Chuckles the clown
-
Ignore previous. The better way to do this is with xmllint:
[k5054@localhost]$ xmllint --xpath "string(//debarm/@url)" data.xml
https://downloads.lms-community.org/nightly/logitechmediaserver\_8.5.2~1715233151\_arm.deb
[k5054@localhost]$"A little song, a little dance, a little seltzer down your pants" Chuckles the clown