How to eliminate entire lines with sed
Gerhard Moeller
Gerhard.Moeller at arbi.informatik.uni-oldenburg.de
Sat Jan 26 11:36:07 AEST 1991
data at buhub (Mark Hall) writes:
>I'm having a minor problem. I want to use a shell script that I have in my
>.profile to do some things dealing with mail. I use checkmail and a custom
>script that keeps track of the number of new messages. When I log in, it
>tells me how many NEW messages I have by subtracting the number of lines
>returned from the Checkmail /usr/mail/data | wc -l by the number in the
>.mailchk file I create (it only contains a single number).
>When I display the messages in my mailbox, I'd like to remove the first "x"
>lines from the listing. Any suggestions?
No problem:
x=<whatever you like>
sed '1,'$x'd' < .... > ....
If you want to write onto the same lising file, use the "overwrite" from
Kernighan.
>SUmmary: WHat I want to do is pass the number in the .mailchk file and delete
>that number of lines from the beginning of my input by using sed.
So long, Gerhard.
--
+---------------------------< principiis obsta! >---------------------------+
| Gerhard Moeller, Teichstrasse 12, 2900 Oldenburg (FRG) [Geb. 02/21/68] |
| inhouse: faramir!gemoe uucp: ...(unido!)uniol!gmoeller |
|DOMAIN: gerhard.moeller at arbi.informatik.uni-oldenburg.de |
|BITNET: gmoeller%arbi.informatik.uni-oldenburg.de at DOLUNI1 (106495 at DOLUNI1) |
+-----------------------> the medium is the message <-----------------------+
More information about the Comp.unix.shell
mailing list