home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!munnari.oz.au!metro!usage!spectrum!cameron
- From: cameron@spectrum.cs.unsw.oz.au (Cameron Simpson)
- Subject: Re: programming challenge
- Message-ID: <1992Dec16.081836.1094@usage.csd.unsw.OZ.AU>
- Sender: news@usage.csd.unsw.OZ.AU
- Nntp-Posting-Host: fuligin.spectrum.cs.unsw.oz.au
- Reply-To: cameron@spectrum.cs.unsw.oz.au (Cameron Simpson)
- Organization: CS&E Computing Facility, Uni Of NSW, Oz
- References: <1992Dec12.100131.11703@zooid.guild.org> <1992Dec16.043128.7616@bby.com.au>
- Date: Wed, 16 Dec 1992 08:18:36 GMT
- Lines: 30
-
- 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.
- - Cameron Simpson
- cameron@cs.unsw.oz.au, DoD 0743
- --
- "The engine purrs beneath me with a purpose,
- ready for the pleasure of my hand upon the throttle." - Peter Smith
-