Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!decwrl!hplabs!hp-pcd!hplsla!hpubvwa!grlab!scott From: scott@grlab.UUCP (Scott Blachowicz) Newsgroups: comp.mail.mush Subject: Re: Head/tail on a message pipeline? Message-ID: <7330017@grlab.UUCP> Date: 24 May 89 20:10:05 GMT References: <7330010@grlab.UUCP> Organization: Graphicus Lines: 27 / grlab:comp.mail.mush / schaefer@ogccse.ogc.edu (Barton E. Schaefer) / 2:27 pm May 21, 1989 / > In article <7330010@grlab.UUCP> scott@grlab.UUCP (Scott Blachowicz) writes: > } Is there a way to do the equivalent of head/tail commands on message numbers > } in a pipeline? (e.g. pick -s 'backup done' | tail +2 | delete) > > You can redefine your pager: > > set oldpager = "$pager" pager = 'tail +2' > pick -s 'backup done' | p | d > set pager = "$oldpager" > unset oldpager > > Each message is sent individually to $pager, so you get the effect you want. I think my "e.g." needed some expansion. What I want to do is cause the delete command to delete all but the first message resulting from the pick command. I've got my mailbox sorted (-d), so this would delete all but the most current message coming through the pipeline if it worked the way I'm trying to get it to work. The particular application is in monitoring some system status stuff. Cron runs some scripts that end up sending me mail. I want to keep the most recent run's output in my mailbox, but if I'm gone for a few days, I can get a few of them accumulating in my mailbox and I want to get rid of them. If there were commands to do basic calculations or message list manipulations, I could do it. Scott Blachowicz scott@grlab.UUCP