scott@grlab.UUCP (Scott Blachowicz) (05/17/89)
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) Scott Blachowicz scott@grlab.UUCP
schaefer@ogccse.ogc.edu (Barton E. Schaefer) (05/22/89)
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) } } Scott Blachowicz } scott@grlab.UUCP 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. Compare to the "pipe" command, with attention to the way it works when you have used "set unix". -- Bart Schaefer "And if you believe that, you'll believe anything." -- DangerMouse CSNET / Internet schaefer@cse.ogc.edu UUCP ...{sequent,tektronix,verdix}!ogccse!schaefer
scott@grlab.UUCP (Scott Blachowicz) (05/25/89)
/ 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