Patrick Hall wrote:
> 
> Hi,

Hello,

> I'd like to push all sequences of capitalized words
> onto an array.
> 
> So, given this paragraph (which I just snagged off AP)
> 
> Indian Prime Minister Atal Bihari Vajpayee said
> Wednesday that India would consider jointly monitoring
> the disputed Kashmir border with its longtime rival
> Pakistan.
> 
> would return:
> 
> Indian Prime Minister Atal Bihari Vajpayee
> Wednesday
> India
> Kashmir
> Pakistan
> 
> It's easy to do this with single words (just split and
> check for initial caps), but extracting *sequences* of
>  capitalized words calls for something, uh, else.
> 
> Any ideas or pointers to a doc somewhere?


perl -00ne'tr/\n /
/s;push@x,grep/\S/,split/\b[a-z]\S+\s/}{print"$_\n"for@x' yourfile.txt


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to