Link to home
Start Free TrialLog in
Avatar of pillaib
pillaib

asked on

pattern matching


Hi
Below is text file...
Please help me grepping out the text between the tags <LOC> and </LOC>.

<LINE><ADM>DOLNOSLASKIE</ADM><LOC>BARDO</LOC><LOC1>OPOLNICA</LOC1><POCO>57-256</POCO><TYPE>Old
Name</TYPE><ADMSYN>WALBRZYSKIE<TYPE>OldName</TYPE></ADMSYN></LINE>
<LINE><ADM>DOLNOSLASKIE</ADM><LOC>BARKOWO K. MILICZA</LOC><LOC1>BARKOWO</LOC1><POCO>55-143</PO
CO></LINE>
<LINE><ADM>DOLNOSLASKIE</ADM><LOC>BARKOWO K. MILICZA</LOC><LOC1>BARKóWKO</LOC1><POCO>55-143</P
OCO></LINE>
<LINE><ADM>DOLNOSLASKIE</ADM><LOC>BARKOWO K. MILICZA</LOC><LOC1>KêDZIE</LOC1><POCO>55-143</POC
O></LINE>


waiting for a favourable reply

Regards
Biju Pillai
Avatar of prady_21
prady_21


This should work

if ( /<LOC>(.*)<\/LOC>/ ) {
      print "$1\n";
}

Avatar of ozo
while( /<LOC>(.*?)<\/LOC>/g ){
     print "$1\n";
}
or as a single line

print "$1\n" while (/<LOC>(.*?)<VLOC>/);
ASKER CERTIFIED SOLUTION
Avatar of hemaraj123
hemaraj123

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Nothing has happened on this question in over 7 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answer by hemaraj123.

Please post any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer