home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / question / 9316 < prev    next >
Encoding:
Internet Message Format  |  1992-07-22  |  1.4 KB

  1. Path: sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!news.eng.c!convex.COM!tchrist
  2. From: tchrist@convex.COM
  3. Newsgroups: comp.unix.questions
  4. Date: 17 Jul 92 23:10 MDT
  5. Subject: Re: Collapsing continuation lines (
  6. Sender: Notesfile to Usenet Gateway <notes@glas.apc.org>
  7. Message-ID: <1992Jul17.191046.1672@news.eng.c>
  8. Nf-ID: #N:1992Jul17.191046.1672@news.eng.c:329777310:001:979
  9. Nf-From: convex.COM!tchrist    Jul 17 23:10:00 1992
  10. Lines: 32
  11.  
  12.  
  13. From the keyboard of davidf@mks.com (David J. Fiander):
  14. :    sed -e '/\|/,/^$/ {
  15. :            /\|/{h;d;}
  16. :            /^./{H;d;}
  17. :            /^$/ {
  18. :                x
  19. :                s/[ \t]*\n[ \t]*/ /g
  20. :                p
  21. :                x
  22. :            }
  23. :        }' inputfile
  24. :
  25. :Pretty scary eh?  No, I didn't come up with this off the top of
  26. :my head, this is a modification of a script which compresses
  27. :RFC-822 continuation lines which I wrote for another purpose.
  28.  
  29. This, BTW, is my major beef with sed.  It's generally pretty fast at what
  30. it does, but has nothing like reasonable variables or reasonable flow
  31. control.  You can do a lot in it, but I'm not sure that it really does
  32. beat a boot to the head.  If someone gives me a working sed script of some
  33. complexity, I'm glad to use it, but I sure would rather develop new
  34. scripts in something further removed from the text-processing equivalent
  35. of machine language.
  36.  
  37. --tom
  38. -- 
  39.     Tom Christiansen      tchrist@convex.com      convex!tchrist
  40.  
  41.     "I never met a chocolate I didn't like." 
  42.     --Deanna Troy, ST:TNG
  43.  
  44.