home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!uswnvg!nv6.uswnvg.com!tcking
- From: tcking@uswnvg.com (Tim King)
- Newsgroups: comp.lang.perl
- Subject: Re: programming challenge
- Message-ID: <2999@uswnvg.uswnvg.com>
- Date: 16 Dec 92 23:12:13 GMT
- References: <1992Dec16.081836.1094@usage.csd.unsw.OZ.AU>
- Sender: news@uswnvg.uswnvg.com
- Organization: U S WEST NewVector Group, Inc.
- Lines: 32
- X-Newsreader: Tin 1.1 PL5
-
- : 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!)
- :
-
- Cameron Simpson (cameron@spectrum.cs.unsw.oz.au) wrote:
- : Ugh. Unless I'm missing something basic, this will work (and I've used this
- : script for years):
- :
- : 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.
-
- Ugh, Ugh. Unless ~I'm~ missing something basic, the 'col' utility is
- specifically for this purpose, stripping out ^H and repeated text. Works
- for underlines too, gals.
-
- col -bx < man.out > man.text
-
- --
- Tim King, tcking@uswnvg.com or uunet!uswnvg!tcking
- US West NewVector Group Inc., Bellevue, Washington
- 206-450-8533
-