Xref: utzoo comp.sources.wanted:16450 comp.unix.questions:30822 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!elroy.jpl.nasa.gov!usc!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.sources.wanted,comp.unix.questions Subject: Re: Searching the output of last Keywords: last awk sed perl C whatever Message-ID: <1991Apr29.040325.1822@athena.mit.edu> Date: 29 Apr 91 04:03:25 GMT References: <1991Apr28.070748.5279@bradley.bradley.edu> <1991Apr29.021236.12132@casbah.acns.nwu.edu> Sender: news@athena.mit.edu (News system) Followup-To: comp.unix.questions Organization: Massachusetts Institute of Technology Lines: 29 In article <1991Apr29.021236.12132@casbah.acns.nwu.edu>, navarra@casbah.acns.nwu.edu (John 'tms' Navarra) writes: |> In article <1991Apr28.070748.5279@bradley.bradley.edu> guru@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@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710