Searching the output of last

Jonathan I. Kamens jik at athena.mit.edu
Mon Apr 29 14:03:25 AEST 1991


In article <1991Apr29.021236.12132 at casbah.acns.nwu.edu>, navarra at casbah.acns.nwu.edu (John 'tms' Navarra) writes:
|> In article <1991Apr28.070748.5279 at bradley.bradley.edu> guru at buhub.bradley.edu (Jerry Whelan) writes:
|> >	Does anyone have/know of a program to parse the output of the
|> >'last' command and tell me who was logged in at some arbitrary time?
|> >I'd like to be able to type: 
|> >
|> > 			whenwho 9:56
|> 
|>          do last | grep time  

  I want to be polite, but I have an overwhelming urge to respond to this by
saying, "Get a clue."

  Mr. Whelan wants to know how to find out who was logged in at any particular
time, not who logged in or logged out at any particular time.

  The output of "last" indicates only the time a user logged in, and the time
he/she logged out.  Therefore, grepping for a particular time will catch only
the people who logged in or logged out during that minute.

  In order to do what Mr. Whelan wants, you need a utility that reads the
output of last (or reads /usr/adm/wtmp directly) and checks each pair of login
and logout times to see if the specified time is between them.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.questions mailing list