Skip site navigation (1)Skip section navigation (2)
Date:      12 Oct 2001 18:21:00 -0700
From:      swear@blarg.net (Gary W. Swearingen)
To:        Randy Bush <randy@psg.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: date of a file
Message-ID:  <9k669ks5c3.69k@localhost.localdomain>
In-Reply-To: <E15s8y6-0003rb-00@rip.psg.com>
References:  <E15s8y6-0003rb-00@rip.psg.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Randy Bush <randy@psg.com> writes:

> in gnu-sh-utils, i can, for example,
> 
>    date -r filename +%y%m%d-%H%M%S
> 
> but, in freebsd, "date -r" says give me the current date in seconds of the
> epoch.
> 
> what should i be doing?

Using python or perl or awk?  This gets close:

ls -lT filename | awk '{printf "%s %s %s %s\n",$9,$6,$7,$8}'

And I think the "date" command can convert dates from, say an output
of "ls" like the above (as $(ls...|awk...)) into fancy formatted
outputs (it uses strptime(3)) formats.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9k669ks5c3.69k>