From owner-freebsd-questions@freebsd.org Sat Jul 13 09:31:26 2019 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74E5F15E4A78 for ; Sat, 13 Jul 2019 09:31:26 +0000 (UTC) (envelope-from kremels@kreme.com) Received: from mail.covisp.net (mail.covisp.net [65.121.55.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D92C76C4E for ; Sat, 13 Jul 2019 09:31:25 +0000 (UTC) (envelope-from kremels@kreme.com) From: "@lbutlr" Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: pkg query timestamp format Date: Sat, 13 Jul 2019 03:31:17 -0600 References: <5D28CD7B.40102@webtent.org> To: freebsd-questions@freebsd.org In-Reply-To: Message-Id: <5343D197-AF3A-490E-AB75-F0624A77A3FE@kreme.com> X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 0D92C76C4E X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Jul 2019 09:31:26 -0000 > On 12 Jul 2019, at 18:30, David Christensen = wrote: >=20 > 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 >=20 > Here's a Perl one-liner: >=20 > 2019-07-12 17:28:52 dpchrist@cvs ~ > $ pkg query %n-%t | perl -ne '/(.+)-(\d+)$/; ($d,$m,$y)=3D(localtime = $2)[3,4,5];$y+=3D1900; 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=E2=80=99t 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. --=20 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.