How to obtain file date rather than current date

Wayne Thompson waynet at tolerant.UUCP
Mon Oct 6 09:28:17 AEST 1986


> 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.
> 
> Please respond directly, as I am not on the list.
> 
> Thank you.
> 
> Sincerely,
> 
>  - Marshall D. Abrams, phone: (703) 883-6938
>    The MITRE Corporation, 7525 Colshire Drive
>    Mail Stop W458, Mc Lean, VA   22102
I followed this up with a reply, but felt that this might well be broadcast.
----------------------------------------------------------------------
I was intrigued by your problem. I have avoided learning formatters, but
had to start friday. The key to solving your problem is using the power
unix to interface many different programs to produce the desired result.
First, create a file which looks like this:

#! /bin/sh
ls -l $1 | awk '{ print ".DA" $5 " " $6 " " $7" }' > mod.date
troff -ms $1
exit

Let's call it modroff.

You must then make make modroff executeable by executing:

chmod 744 modroff

This will make the file that you just created executeable.
Additionally, the file modroff must by in your search_path.
I will assume that you are using /bin/cshrc for your shell (if your
using /bin/sh ask for loacl help or send me email.
My search path includes my own personal executeable directly with the
inclusion of th following addtion to my ~/.login:

set mail=/usr/spool/mail/$user
alias msgs msgs -p
if (-e /b/other/.login) source /b/other/.login
***setenv PATH ~/bin:${PATH}:/usr/lib/news
fortune -a
checknews

*** <- is for illustration and not included in the original file.

What that means is that my search path for executeable files will be
my personal ~/bin directory followed by what's included in /b/other/.login
followed by /usr/lib/news (which on my system includes uu{en,de}code).

So the point of all this is that the directory ~/bin is included in your
search path (which may be a good place for your file modroff).

modroff will produce the file mod.date which will contain:

.DA "last modified"

The file which you would like to print MUST include the following
statement:

.so mod.date

You would invoke troff with the command

% modroff filename

P. S.
   I hope you won't be offended by my detail, but I felt it were better to
include all details and assume you weren't familiar with other aspects of
unix.
-- 
Which is worse ignorance or apathy? Who knows, who cares.

Wayne Thompson
..{bene,mordor,nsc,oliveb,pyramid,ucbvax}!tolerant!waynet

Your mission, should you decide to accept it, is to discern who is
responsible for these opinions, the poster or the company he works for.
Good luck!!



More information about the Comp.unix mailing list