bash 4.4.20 and jq-1.6 on RHEL8
I get this nice output from jq and column. Hard to read, though.
pgbackrest info --output=json \
| jq -r '.[] | .backup[] | "\(.type) \(.label) \(.info.delta)"' \
| column -t
full 20250712-224418F 57448997604
full 20250712-231256F 57391883702
full 20250713-000402F 57448997604
full 20250713-013005F 57447727844
incr 20250713-013005F_20250714-000002I 4960846146
[snip]
incr 20250817-101503F_20250822-000002I 8954487106
incr 20250817-101503F_20250823-000002I 9482330434
full 20250824-014502F 53490962042
incr 20250824-014502F_20250825-000002I 5594054978
incr 20250824-014502F_20250826-000002I 6828647855
Piping it through a while loop, reading into three separate variables and then printf to convert the third column using numfmt also works, but seems so brutal. Is there a cleverer way to do it (where "it" either converts to human-readable or adds thousands-separators)?
pgbackrest info --output=json \
| jq -r '.[] | .backup[] | "\(.type) \(.label) \(.info.delta)"' \
| (while IFS= read -r line; do
IFS=" " read Type Label Size <<< "$line"
printf "%s %s %s\n" $Type $Label $(numfmt --to=si --suffix=B $Size)
done) | column -t
full 20250712-224418F 58GB
full 20250712-231256F 58GB
full 20250713-000402F 58GB
full 20250713-013005F 58GB
incr 20250713-013005F_20250714-000002I 5.0GB
[snip]
incr 20250817-101503F_20250822-000002I 9.0GB
incr 20250817-101503F_20250823-000002I 9.5GB
full 20250824-014502F 54GB
incr 20250824-014502F_20250825-000002I 5.6GB
incr 20250824-014502F_20250826-000002I 6.9GB
jsoninput to play with?