Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.jpl.nasa.gov (Larry Wall) Newsgroups: comp.unix.questions Subject: Re: Searching the output of last Keywords: last awk sed perl C whatever Message-ID: <1991Apr30.175521.17233@jpl-devvax.jpl.nasa.gov> Date: 30 Apr 91 17:55:21 GMT References: <1991Apr29.040325.1822@athena.mit.edu> <1991Apr29.043041.20454@casbah.acns.nwu.edu> <1991Apr29.072206.5621@jpl-devvax.jpl.nasa.gov> <130922@uunet.UU.NET> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 23 In article <130922@uunet.UU.NET> rbj@uunet.UU.NET (Root Boy Jim) writes: : The first file contains login records for today only. : The second is cumulative for the entire month. : We upgraded the OS yesterday, so you can extrapolate : that it would take about an hour alone to run last : on a whole month's statistics. : : >last|perl -pe '$_ x=/(..:..)...(.*)/&&"'$1'"ge$1&&"'$1'"lt$2' : > : >That's gonna be tough for Randal to beat... :-) : : I just ran it with args 12:34 and 23:45. Here's the timing: : 137.510u 88.580s 4:58.87 75% 0+0k 212+7io 0pf+0w : : Five minutes for one day. Two and 1/2 hours for the entire month. : : OK, so we're not a typical site :-) Oh, good grief. I wasn't optimizing for speed, but brevity (obscurity?). By all means, read the file directly if you want speed. There's More Than One Way To Do It. Larry