home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7372 < prev    next >
Encoding:
Text File  |  1992-12-11  |  1.3 KB  |  32 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!spool.mu.edu!sol.ctr.columbia.edu!eff!news.oc.com!convex!tchrist
  3. From: Tom Christiansen <tchrist@convex.COM>
  4. Subject: Re: Delete until pattern match
  5. Originator: tchrist@pixel.convex.com
  6. Sender: usenet@news.eng.convex.com (news access account)
  7. Message-ID: <1992Dec12.011324.4713@news.eng.convex.com>
  8. Date: Sat, 12 Dec 1992 01:13:24 GMT
  9. Reply-To: tchrist@convex.COM (Tom Christiansen)
  10. References: <3722@symbas.UUCP>
  11. Nntp-Posting-Host: pixel.convex.com
  12. Organization: Convex Computer Corporation, Colorado Springs, CO
  13. X-Disclaimer: This message was written by a user at CONVEX Computer
  14.               Corp. The opinions expressed are those of the user and
  15.               not necessarily those of CONVEX.
  16. Lines: 14
  17.  
  18. From the keyboard of hans@symbas.lind.no:
  19. :I have some files in which I want to delete all lines until a
  20. :certain pattern match. I know a couple of awkward ways to do it,
  21. :( using an array as temporary storage etc.) 
  22. :but is there a quicker and more elegant solution ?
  23.  
  24. perl -i.bak -ne '(1../pattern/) || print'
  25.  
  26. --tom
  27. -- 
  28.     Tom Christiansen      tchrist@convex.com      convex!tchrist
  29.         echo "Hmmm...you don't have Berkeley networking in libc.a..."
  30.         echo "but the Wollongong group seems to have hacked it in."
  31.             --Larry Wall in Configure from the perl distribution
  32.