Posted on 07-23-2015 11:55 AM
Got this, but it returns all EAs (curl -u user:pass https://server-int.company.org:8443/JSSResource/computers/id/2134 | xpath '/computer/extension_attributes/extension_attribute')
I'd like only a single attribute specified by ID 45. Anyone have a good way to do that?
Posted on 07-23-2015 12:03 PM
If the EA value is on a single line and not something that would have multiple lines, something like this
curl -H "Accept: application/xml" -sfku user:pass https://server-int.company.org:8443/JSSResource/computers/id/2134/subset/extensionattributes | xmllint --format - | grep -A4 "<id>45</id>" | awk -F'>|<' '/value/{print $3}'
There might be a better way of doing this though, but the above is probably the approach I'd take.
Posted on 07-23-2015 12:18 PM
Thanks, @mm2270 xmllint is a good tool I should use more.