> On Mar 10, 2021, at 1:08 PM, Wietse Venema <wie...@porcupine.org> wrote: > >> For machine-readable output, try "postqueue -j", which reports dates in >> epoch time. For example: >> >> $ postqueue -j | >> jq -r '[.queue_id, (.arrival_time | tostring), .sender] | join(" ")' > > I used this: > > jq -r '[.queue_id, (.arrival_time | todate), .sender] | join(" ")' > > Which formats the date as iso8601 (yyyy-mm-dd-Thh:mm:ssZ
Indeed, or for local time (with SPACE instead of 'T') and tab-separated output: jq -r '[.queue_id, (.arrival_time | localtime | strftime("%Y-%m-%d %H:%M:%S")), .sender, .recipients[].address] | @tsv' ... Only now in theory the output is ambiguous due to potential <TAB> characters in the addresses. @json, @csv and @sh are machine-readable without ambiguity. Keep in mind that with "@csv" and "@sh" some fields may contain embedded newlines. The "@sh" format is not easy to work with, avoid unless you really know what you're doing. -- Viktor.