Problem with date...

Matthew Seaman m.seaman at infracaninophile.co.uk
Wed Oct 29 10:14:19 PST 2003


On Wed, Oct 29, 2003 at 12:58:21PM -0500, Xpression wrote:
>         Hi all, I'm logging certain types of files to a daily grouping with
> the following format `date +%v` and the output format for today is eg.
> 29-Oct-2003, it's fine but this happens at 12:00 pm at night to rotate
> everyday, and I want to check and edit some lines on the file that was
> recorded but date is the actual and date +%v return me the date of today and
> not of yesterday, is there a way to recognize the past file ???

You can produce the date formatted as you wish but for 1 day ago by:

    % date -v-1d +%v

It's also a good tip when dealing with files with a datestamp in their
name if you use a format more like:

    % date +%Y-%M-%d

(ie. 2003-10-29 for today).  This has the very useful property that
your directory listing will come out in *date* order.

	Cheers,

	Matthew


-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20031029/caa3e6d4/attachment.bin


More information about the freebsd-questions mailing list