How to obtain file date rather than current date

dave at sq.UUCP dave at sq.UUCP
Thu Oct 9 08:20:34 AEST 1986


In article <4353 at brl-smoke.ARPA> abrams at MITRE.arpa (Marshall D. Abrams) writes:
>I am using troff with the ms macros to produce hardcopy of a file
>which is getting many updates.  When I print it I am using the DA
>directive to get the date printed on the hardcopy.  But this is the
>date printed.  I would much rather have the date that the file
>was last revised.  Any suggestion on how to do this would be
>appreciated.

The following troff macro, gR (GetReviseTime), assigns the latest
revision-date of the file in which it appears to the string whose name
is the argument in a call to gR:

.de gR
.sy echo ".ds \\$1 `ls -l \n(.F | awk '{print $5, $6, $7}'`">/tmp/date\n($$
.so /tmp/date/\n($$
.sy rm /tmp/date\n($$

After the above, in the file which is being formatted by ms, the
following:

.gR dR
\*(dR

would place the respective date in the output. It also works independent
of the ms macros.

Note: the .sy request is available in DWB and ditroff.

--------------------------------------------------------------
SoftQuad	Toronto, Ontario, Canada	(416) 963-8337
David Seaman	utzoo!sq!dave



More information about the Comp.unix mailing list