The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk: need to extract a line before a pattern npn35 Shell Programming and Scripting 17 06-29-2008 11:38 PM
Extract if pattern matches Raynon Shell Programming and Scripting 20 10-29-2007 04:44 AM
Extract the Pattern aajan UNIX for Dummies Questions & Answers 6 08-08-2007 05:47 AM
Please help! Sed extract a pattern zhen Shell Programming and Scripting 11 09-18-2006 01:36 PM
How to extract a sequence of n lines from a file 0ktalmagik Shell Programming and Scripting 4 06-30-2006 12:24 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-10-2007
jaganadh jaganadh is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 32
Post Extract Pattern Sequence

Dear Collegues
I have to extract Some pattern from raw text file using perl

The input will be raw text.
Pattern to get - Sequence of Capital Letter Words ( e.g. he is working in Center for Perl Studies. He will come tomorrow...) from thos I have to extract sequences like "Center for Perl Studies " and "C.P.S".

Any logic to impliment it in perl

Jaganadh G
Linguist
  #2 (permalink)  
Old 12-10-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,764
Define sequence. You left "He" out of processing. Do you require 2,3,4...? items to be capitalized?
  #3 (permalink)  
Old 12-10-2007
jaganadh jaganadh is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 32
sequence : any sequence of Cpital letter e.g name of companies etc and abbriviations.
I have to extract Name of Companies and Abbriviations from a text using perl

Jaganadh G
  #4 (permalink)  
Old 12-10-2007
bigearsbilly bigearsbilly is offline
Registered User
  
 

Join Date: Feb 2006
Location: Southern England
Posts: 104
It is a very non-trivial problem,
for example:


Code:
billym.>X="he is working in Center for Perl Studies. He will come tomorr>
billym.>echo $X |perl -pe 's/([A-Z])\S*/$1\./g'                          
he is working in C. for P. S. H. will come tomorrow.
you could have a large list of ignore words maybe, like for, the, he, it, and

interesting, will I get paid?
  #5 (permalink)  
Old 12-10-2007
jaganadh jaganadh is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 32
from the sentence i have to get Center for Perl Studies only.
Sequences like Center for Perl Studies
Jaganadh G
  #6 (permalink)  
Old 12-10-2007
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,322
Code:
#!/usr/bin/perl
#
my @arraytest = ("Test", "for", "Capital", "letters");
my @resulttest = grep /[A-Z]/, @arraytest;
print "@resulttest\n"
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:14 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0