Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Perl & Groff (psed)

by blue.monk (Novice)
on Jun 23, 2004 at 15:52 UTC ( [id://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 

Replies are listed 'Best First'.
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 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 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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-16 06:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found