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