develooper Front page | perl.beginners | Postings from February 2009

Re: Add Line break when first of a line changes

Thread Previous | Thread Next
From:
Telemachus
Date:
February 15, 2009 07:13
Subject:
Re: Add Line break when first of a line changes
Message ID:
20090215151237.GA4868@ilium
On Sun Feb 15 2009 @  8:56, Jack Butchie wrote:
> I did some fiddling with the list.  I noticed if the second or third or  
> whatever column wasn't exactly the same as the previous, even though the 
> tex in the first field was the same,  line was being added. I then tested 
> with only the first field in the list and it worked perfectly. The script 
> seems not to like anything different in other columns/fields.
>
> LAWN
> LAWN
> LAWN
> PORCHES
> WARTHOGS

Right, as I said (and Gunnar made clearer), this is *not* testing product
names for equality. It's testing the entire lines for equality.

Which field do you actually want to test? Now that I look at your initial
email, I'm guessing that what you actually want to test is "LAWN SEED"
against "LAWN SEED1" - which makes things a bit more complicated. Your file
doesn't have a consistent field separator (sometimes a space is part of a
product name, sometimes not). A solution that works for "LAWN SEED" and
"LAWN SEED1" won't be identical to one for "LAWN SEED1" compared to
"MULCH".

So, what does the file really look like?

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About