pkg query timestamp format
kremels at kreme.com
Sat Jul 13 09:31:26 UTC 2019
> On 12 Jul 2019, at 18:30, David Christensen <dpchrist at holgerdanske.com> wrote:
> On 7/12/19 11:12 AM, Robert Fitzpatrick via freebsd-questions wrote:
>> When I use the following command, I get packages with timestamp installed in epoch Unix time. Is there any way to format that date into month, day and year?
>> pkg query %n-%t
> Here's a Perl one-liner:
> 2019-07-12 17:28:52 dpchrist at cvs ~
> $ pkg query %n-%t | perl -ne '/(.+)-(\d+)$/; ($d,$m,$y)=(localtime $2)[3,4,5];$y+=1900; printf "%-50s %4i-%02i-%02i\n", $1, $y, $m ,$d'
> bash 2019-01-21
> cvs 2019-01-21
> gettext-runtime 2019-01-21
I tried to add a | sort -k 2, thinking that would sort the output by date, but while it changed the order of the output (no other number did), it wasn’t based on the date column. Not sure what it was based on.
I also tried -k 2,4 and -k 2 -k 3
I assume I am missing something bloody obvious.
Yeah, Nick. Nick's the kinda guy you can trust. Nick's your buddy Nick's
the kinda guy you drink beers with. The kinda guy that doesn't care if
you puke in his car. Nick.
More information about the freebsd-questions