On Thu, 26 Sep 2002, Zary Necheva wrote:

> Hi,
> I have a file with this data:
> 
> ..CITY/STATE. |aBalt., MD
> ..COUNTY.   |aBALTIMORE
> ..CITY/STATE. |aBaltimore, Md
> ..COUNTY.   |aBALTIMORE
> ..CITY/STATE. |aBaltimore, Maryland
> ..COUNTY.   |aBALTIMORE
> ..CITY/STATE. |aBaltimore,  MD
> ..COUNTY.   |aBALTIMORE
> ..CITY/STATE. |aBALTIMORE, Md
> ..COUNTY.   |aBALTIMORE
> ……
> 
> The data has to be change this way”
> ..CITY/STATE. |aBaltimore, MD
> ..COUNTY.   |aBALTIMORE
> ..CITY/STATE. |aBaltimore, MD
> ..COUNTY.   |aBALTIMORE
> ………………
> This is my script :
> 
> #!/usr/bin/perl -w
> use strict;
> 
> while(<>){
>         s/\.CITY\/STATE\. \|aBalt*/\.CITY\/STATE\. \|aBaltimore, MD/g;

aBalt* means the string 'aBal' followed by 0 or more t's. I guess you need
aBalt.*

Looking at your input you don't need the /g flag. Are you trying to 
substitue 'aBalt.' with 'aBaltimore'. If this is the case why match 
everything before it, just write the regex as
s/(\|aBalt)\./$1imore./



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

Reply via email to