Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!ames!mindcraft.com!karish From: karish@mindcraft.com (Chuck Karish) Newsgroups: news.software.b Subject: Re: Cnews expire problem... need help Summary: This is way too complicated Message-ID: <660770337.20986@mindcraft.com> Date: 9 Dec 90 19:18:56 GMT References: <1990Dec7.130639.15803@bnr.ca> <660596702.10086@mindcraft.com> <1990Dec8.190114.15171@sceard.Sceard.COM> Organization: Mindcraft, Inc. Lines: 30 In article <1990Dec8.190114.15171@sceard.Sceard.COM> mrm@Sceard.COM (M.R.Murphy) writes: > >The following code cleans up a history file so that mkdbm is happy with it, >and also replaces the single awk line that sifts a history file and prints >only lines that are after a given time that I used in a modified expire scheme. >The checking for goodness in a history line could be made fancier, but this is >enough to make mkdbm happy. Makes for a pretty fast expire, too. Every so often, >writing a short specialized tool in C is appropriate, though I'd rather use >awk :-) This C program is needed only to avoid re-writing the whole history file during checking. On my machine, the mkdbm step takes much longer than the scan anyway and I have enough disk space for a second copy of history, so I use this one-liner in sed: sed -n 's/^<.* /p' # The white space in the pattern is a tab. >... >now=`getdate now` >ago=`awk "/^\/expired\// {print ($now-(86400*\$(3)))} {next}" explist` ># replace the single-line awk with exphist >#awk "{split(\$2,dates,\"~\");if(dates[1]>$ago)print \$0}" history >history.n Doesn't this reproduce the functionality specified by the 'expired' line in the expire control file? -- Chuck Karish karish@mindcraft.com Mindcraft, Inc. (415) 323-9000