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

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!caen!malgudi.oar.net!chemabs!jon
  3. From: jon@cas.org (Jon Vander Hill)
  4. Subject: Re: programming challenge
  5. In-Reply-To: cameron@spectrum.cs.unsw.oz.au's message of Wed, 16 Dec 1992 08:18:36 GMT
  6. Message-ID: <JON.92Dec16105534@cas.org>
  7. Sender: usenet@cas.org
  8. Organization: Chemical Abstracts Service, Columbus, Ohio
  9. References: <1992Dec12.100131.11703@zooid.guild.org> <1992Dec16.043128.7616@bby.com.au>
  10.     <1992Dec16.081836.1094@usage.csd.unsw.OZ.AU>
  11. Date: Wed, 16 Dec 1992 15:55:34 GMT
  12. Lines: 36
  13.  
  14. >>>>> On Wed, 16 Dec 1992 08:18:36 GMT, cameron@spectrum.cs.unsw.oz.au (Cameron Simpson) said:
  15.  
  16. > gnb@baby.bby.com.au (Gregory N. Bond) writes:
  17. > | If you are editing man pages, they probably contain things like
  18. > | E^HE to make things bold, and _^HE (or E^H_, depending on your
  19. > | nroff) to underline them.  Rather than stripping the ^Hs then
  20. > | compressing the repeats, what about doing both at once:
  21. > | 
  22. > |     perl -pi.bak -e 's/(.)\cH$1/$1/g;s/_\cH(.)/$1/g;' {files}
  23. > | 
  24. > | (NB: \b is word boundry in regexps! Use ^H instead!)
  25.  
  26. > Ugh. Unless I'm missing something basic, this will work (and I've used this
  27. > script for years):
  28.  
  29. >     #!/bin/sh
  30. >     #
  31. >     # Remove nroff-style underlining and overstriking.
  32. >     # Works for other stuff, too.
  33. >     #
  34.  
  35. >     exec sed 's/.^H//g' ${1+"$@"}
  36.  
  37. > Thus,
  38. >     unbs man.out > man.text
  39.  
  40. > It starts up much faster than Perl. That ^H is a literal control-H, guys.
  41.  
  42. Back to perl:
  43.  
  44. perl -lpe 's/.^H//g' man.out >man.text
  45.  
  46. I see no noticable lag in startup time on my system.
  47.  
  48. Jon Vander Hill
  49. jon@cas.org
  50.