3 ms·
I've been using sed, awk, and friends for I find myself reaching for 30+ years, refer to jq documentation 90% of the time I use it (vs. <<10% when using traditi
by jasomill 3y ago
I've been using sed, awk, and friends for I find myself reaching for 30+ years, refer to jq documentation 90% of the time I use it (vs. <<10% when using traditional UNIX tools), and still appreciate JSON output as an option.
Incidentally, PowerShell has nice built-in facilities for working with JSON:
/Users/jtm> (
>> diskutil list -plist `
>> | plutil -convert json -o - - `
>> | ConvertFrom-Json
>> ).AllDisksAndPartitions.APFSVolumes `
>> | where MountPoint `
>> | select `
>> VolumeName,`
>> @{L='Size';E={$_.Size/1GB}},`
>> @{L='Free';E={($_.Size - $_.CapacityInUse)/1GB}} `
>> | where {
>> $_.Free / $_.Size -lt 0.10
>> } `
>> | sort VolumeName `
>> | ConvertTo-Json
[
{
"VolumeName": "Gríðarvölr",
"Size": 1862.8213348388672,
"Free": 150.1973648071289
},
{
"VolumeName": "Mjölnir",
"Size": 1862.6963348388672,
"Free": 92.34595108032227
}
]