Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!sdd.hp.com!spool2.mu.edu!uunet!fub!uniol!Gerhard.Moeller From: Gerhard.Moeller@arbi.informatik.uni-oldenburg.de (Gerhard Moeller) Newsgroups: comp.unix.shell Subject: Re: How to eliminate entire lines with sed Keywords: remove lines, sed Message-ID: <4373@uniol.UUCP> Date: 26 Jan 91 00:36:07 GMT References: <1991Jan25.070712.17725@bradley.bradley.edu> Organization: University of Oldenburg, Germany Lines: 30 data@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= 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@arbi.informatik.uni-oldenburg.de | |BITNET: gmoeller%arbi.informatik.uni-oldenburg.de@DOLUNI1 (106495@DOLUNI1) | +-----------------------> the medium is the message <-----------------------+