[clug] incrementing time

Rousak, Boris Boris.Rousak at actewagl.com.au
Wed Nov 5 10:43:51 EST 2003


This would be wonderful, unfortunately the file contains potentially up to
20 time stamps inside it, each of which has to be checked. So checking the
file creation/last modification time will only give me references to 2 of
the dates. I could however make a separate file for each date, couldn't
I....hmmm... Might have to try this. 
Thanks for all the advice :)
Boris

-----Original Message-----
From: Nemo -earth native- [mailto:nemo at nut.house.cx]
Sent: Wednesday, 5 November 2003 10:32 AM
To: Rousak, Boris
Cc: 'CLUG'
Subject: Re: [clug] incrementing time


On Wed, Nov 05, 2003 at 09:48:24AM +1100, Rousak, Boris did utter:

> This is a bit basic but I am having a mind blank :). I am trying to write
a
> script that will check a time stamp written in a file to see if it has
been
> an hour since it was made. The stamp is in a format, Nov 03 07:32:06. I am

Just occured to me - how important is it that you check since hte time
the file was /made/, compared to last modified?

`date` will give you seconds since epoch for hte modification time of a
file simply with:

date -r /path/to/file +%s

Comparing the result of that with date +%s then becomes very trivial. 

If the creation time is the important time, rather than modification,
then parsing the output of `ls` looks to be the solution. 
(something like (insert your own --time= option in as necessary):
date -d "`ls -o base3| awk -F' ' '{print $5" "$6" "$7}'`" +%s

Hope this helps 

.../Nemo
-- 
  ------------------------------------------ --------------------------
                                                    earth native

************************************************************************
*PLEASE NOTE*  This email and any attachments may
be confidential. If received in error, please delete all 
copies and advise the sender. The reproduction or 
dissemination of this email or its attachments is 
prohibited without the consent of the sender.

WARNING RE VIRUSES:  Our computer systems sweep
outgoing email to guard against viruses, but no warranty 
is given that this email or its attachments are virus free. 
Before opening or using attachments, please check for 
viruses.  Our liability is limited to the re-supply of any 
affected attachments.

Any views expressed in this message are those of the 
individual sender, except where the sender expressly,
and with authority, states them to be the views of the 
organisation.
************************************************************************



More information about the linux mailing list