[SunHELP] Solaris Date commands

Gavin Winter sunhelp at sunhelp.org
Sun Nov 4 17:18:13 CST 2001


Hello all,
I am new to shell scripting and I am attempting to solve a somewhat complex
problem. On our Solaris 8 box (SPARC) we have a dir with many files. Each
file (flat text) has, in the header record, a timestamp field indicating the
date/time the file was created.  The files have to be processed in timestamp
order, i.e. oldest first.  The unix timestamp against the file is not a
valid indicator of age in this case.

And example of the timestamp field is as follows...
20011025015826
(YYYYMMDDHH24MISS)

I can loop through the files easily enough, reading in the date field but
this make it very difficult to do comparisons between dates to find the
oldest file. I think the easiest method would be to convert the string to a
date format, do a comparison on the date format (perhaps using seconds from
1970 or similar) and proceed forthwith to date the files. However I cannot
find any unix commands to help me do this.

Does anyone have any advice to offer on this?

regards
Gavin Winter




More information about the SunHELP mailing list