> Perlwannabe wrote:
>>
>> I originally tried to do this, but it won't work. The data doesn't
>> _always_ have a before address, sometimes (although seldom) it
>> has a . With grep I would miss the entire address. However,
>> if I were to just select everything and replace it with nothing, that
Perlwannabe wrote:
>
> I originally tried to do this, but it won't work. The data doesn't
> _always_ have a before address, sometimes (although seldom) it has a
> . With grep I would miss the entire address. However, if I were
> to just select everything and replace it with nothing, that would
> Perlwannabe wrote:
>>
>> I posted a problem to the mailing list with a similar question I had
>> some time ago regarding replacing data between fields. Unfortunately,
>> I am having a difficult time with the problem. I am including the
>> code and a sample of the data. Could someone please giv
Perlwannabe wrote:
>
> I posted a problem to the mailing list with a similar question I had some
> time ago regarding replacing data between fields. Unfortunately, I am
> having a difficult time with the problem. I am including the code and a
> sample of the data. Could someone please give me a
On Thursday, September 11, 2003, at 01:03 AM, R. Joseph Newton wrote:
James Edward Gray II wrote:
...
Address:2933HummingbirdSt.City:GrotonSta
te
:CT
Address:4321SparrowAve.City:GrotonState:<
ta
b>CT
. . .
What I want to do is get all of the data between Address: and City:
and
strip the
James Edward Gray II wrote:
> ...
> > Address:2933HummingbirdSt.City:GrotonState
> > :CT
> > Address:4321SparrowAve.City:GrotonState: > b>CT
> > . . .
> >
> > What I want to do is get all of the data between Address: and City: and
> > strip the and replace with spaces. The only problem is that
On Wednesday, September 10, 2003, at 09:20 AM, Jeff 'japhy' Pinyan
wrote:
On Sep 10, James Edward Gray II said:
tr/\t/ /;
s/(^| )([A-Za-z]+:) / length($1) ? "\t$2\t" : "$2\t" /eg;
This does work on all the sample lines you provided.
I'd remove the length() call, and just see if $1 is true (" ")
On Sep 10, James Edward Gray II said:
>tr/\t/ /;
>s/(^| )([A-Za-z]+:) / length($1) ? "\t$2\t" : "$2\t" /eg;
>
>This does work on all the sample lines you provided.
I'd remove the length() call, and just see if $1 is true (" ") or false
("").
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] ht
On Wednesday, September 10, 2003, at 12:52 AM, Alejandro Chavarria -
CyPage wrote:
James,
If you ask the whole list your questions, you probably won't have to
wait until I wake up to get an answer. ;)
Why is the "tr/\t/ /;" substitution better than just using s///g;?
Thanks
Transliterate do
On Tuesday, September 9, 2003, at 11:19 PM, perlwannabe wrote:
On Tuesday, September 9, 2003, at 08:58 PM, perlwannabe wrote:
I know it involves using the s/// operator to both strip the tabs and
replace with but the problem is that it requires using an array
for
each address...and that is w
> On Tuesday, September 9, 2003, at 08:58 PM, perlwannabe wrote:
>
>> I know it involves using the s/// operator to both strip the tabs and
>> replace with but the problem is that it requires using an array
>> for
>> each address...and that is what is creating problems for me.
>>
>> Thanks...
>
>> I know it involves using the s/// operator to both strip the tabs and
>> replace with but the problem is that it requires using an array
>> for each address...and that is what is creating problems for me.
>
>
> s{ (?<=Address:\t) (.+?) (?=\tCity:) }
> { ( $a = $1 ) =~ tr/\t/ /; $a }ex;
Perlwannabe wrote:
>
> I have a text file that has various addresses in different formats. I
> need to remove any items that are not part of the address so the output is
> standard. Here is an example of the input file:
>
> Address:1234MockingbirdLaneCity:GrotonState:CT
> Address:2933Hummingbir
On Tuesday, September 9, 2003, at 09:26 PM, James Edward Gray II wrote:
Hmm, let me think out loud a little.
I think I see a pattern, so let's first change all of them to spaces.
That's easy enough:
s/\t/ /g;
Obviously it was more out loud than thinking. ;) Let's change that to
the better:
On Tuesday, September 9, 2003, at 08:58 PM, perlwannabe wrote:
I have a text file that has various addresses in different formats. I
need to remove any items that are not part of the address so the
output is
standard. Here is an example of the input file:
Address:1234MockingbirdLaneCity:Grot
15 matches
Mail list logo