This very dirty bash snippet works (currently):
#!/bin/sh JSON=$(wget -qO- 'http://downloadcenter.intel.com/JSONDataProvider.aspx?sort=Date&sortDir=descending&Hits=1&keyword="Linux microcode "&lang=eng&refresh=filters&dataType=json') VERSION=$(echo $JSON | sed 's/^.*,"version":"\([^"]*\).*$/\1/') DOWNLOADID=$(echo $JSON |sed 's/^.*,"downloadid":"\([^"]*\).*$/\1/') wget "http://downloadmirror.intel.com/${DOWNLOADID}/eng/microcode-${VERSION}.tgz"
It's obviously incorrect to run sed on serialized data, though. And this example will fail on marginal changes.
Better ways of parsing JSON (such as using python) are discussed at http://stackoverflow.com/questions/1955505/parsing-json-with-sed-and-awk
This very dirty bash snippet works (currently):
#!/bin/sh downloadcenter. intel.com/ JSONDataProvide r.aspx? sort=Date& sortDir= descending& Hits=1& keyword="Linux microcode "&lang= eng&refresh= filters& dataType= json') "version" :"\([^" ]*\).*$ /\1/') "downloadid" :"\([^" ]*\).*$ /\1/') downloadmirror. intel.com/ ${DOWNLOADID} /eng/microcode- ${VERSION} .tgz"
JSON=$(wget -qO- 'http://
VERSION=$(echo $JSON | sed 's/^.*,
DOWNLOADID=$(echo $JSON |sed 's/^.*,
wget "http://
It's obviously incorrect to run sed on serialized data, though. And this example will fail on marginal changes.
Better ways of parsing JSON (such as using python) are discussed at stackoverflow. com/questions/ 1955505/ parsing- json-with- sed-and- awk
http://