Newsgroups: comp.unix.questions Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!casbah.acns.nwu.edu!navarra From: navarra@casbah.acns.nwu.edu (John 'tms' Navarra) Subject: Re: Searching the output of last Message-ID: <1991Apr29.043041.20454@casbah.acns.nwu.edu> Keywords: last awk sed perl C whatever Organization: Northwestern University References: <1991Apr28.070748.5279@bradley.bradley.edu> <1991Apr29.021236.12132@casbah.acns.nwu.edu> <1991Apr29.040325.1822@athena.mit.edu> Date: Mon, 29 Apr 1991 04:30:41 GMT Lines: 38 In article <1991Apr29.040325.1822@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes: >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. My bad! I misread the question. how bout setting up a program that has two arguments: a interval and a begining time. Then it looks thru utmp by doing a last | grep time ( might be slow) where time is the starting time and then increments it by one for interval loops. This will catch all ocurrences of someone being logged in at a particular interval but the trouble would be that you need some way to filter the output because it will report a users name everytime thru the loop if he was logged on for more than a minute in the specified interval. Just a suggestion -- needs some work though. >-- >Jonathan Kamens USnail: >MIT Project Athena 11 Ashford Terrace >jik@Athena.MIT.EDU Allston, MA 02134 >Office: 617-253-8085 Home: 617-782-0710 -- From the Lab of the MaD ScIenTiST: navarra@casbah.acns.nwu.edu