Xref: utzoo comp.unix.questions:30871 comp.lang.perl:5130 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!rbj From: rbj@uunet.UU.NET (Root Boy Jim) Newsgroups: comp.unix.questions,comp.lang.perl Subject: Re: Searching the output of last Keywords: last awk sed perl C whatever Message-ID: <130922@uunet.UU.NET> Date: 30 Apr 91 04:19:46 GMT References: <1991Apr29.040325.1822@athena.mit.edu> <1991Apr29.043041.20454@casbah.acns.nwu.edu> <1991Apr29.072206.5621@jpl-devvax.jpl.nasa.gov> Followup-To: comp.unix.questions Organization: UUNET Communications Services, Falls Church, VA Lines: 40 lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: >If we can assume nobody is logged in overnight (or that records aren't kept), >then I'd just process the output of "last", like this: We have the opposite situation. lots of people logged on for a short time. Here are a few interesting statistics: 11:37pm /USR/sys/conf [root@uunet 288] ll /usr/adm/wtmp 1224 -rw-r--r-- 1 root bin 1238724 Apr 29 23:37 /usr/adm/wtmp 11:37pm /USR/sys/conf [root@uunet 289] ll /USR/adm/wtmp 23128 -rw-rw-r-- 1 root wheel 23652936 Apr 28 10:04 /USR/adm/wtmp 11:50pm /USR/sys/conf [root@uunet 291] date;last|wc;date Mon Apr 29 23:51:00 EDT 1991 17354 162894 1214646 Mon Apr 29 23:53:56 EDT 1991 11:53pm /USR/sys/conf [root@uunet 292] 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 :-) >Larry -- [rbj@uunet 1] stty sane unknown mode: sane