Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Perl & Groff (psed)

by blue.monk (Novice)
on Jun 23, 2004 at 15:52 UTC ( #369087=perlquestion: print w/ replies, xml ) Need Help??
blue.monk has asked for the wisdom of the Perl Monks concerning the following question:

Howdy --

groff (-mm) takes:

THE QUICK BROWN FOX
jumped over the lazy dog
And turns it into this:
THE QUICK BROWN FOX jumped over the lazy dog
What I want use psed to turn it into this:
.H 
THE QUICK BROWN FOX
.BP
jumped over the lazy dog
In short anytime there's 2 or more CAPS work togather insert a .H (header) tag beofore and a .BP (paragraph break at the end of the CAP words.

Any ideas?
David

 editted by jeffa - formatting 

Comment on Perl & Groff (psed)
Re: Perl & Groff (psed)
by gellyfish (Monsignor) on Jun 23, 2004 at 16:12 UTC

    You mean something like:

    perl -pi -e's/(^.*[A-Z]{2,}.*)$/.H\n$1\n.BP/' <files>
    ?

    /J\

Re: Perl & Groff (psed)
by Abigail-II (Bishop) on Jun 23, 2004 at 16:15 UTC
    You mean something like this:
    s/([A-Z][A-Z\s]*[A-Z])\s*/.H\n$1\n.BP\n/g

    Abigail

Re: Perl & Groff (psed)
by blue.monk (Novice) on Jun 23, 2004 at 23:30 UTC
    Thanks to you both :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://369087]
Approved by jlk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-07-28 05:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (186 votes), past polls