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

Re: Add Line break when first of a line changes

Thread Previous | Thread Next
From:
Gunnar Hjalmarsson
Date:
February 15, 2009 06:57
Subject:
Re: Add Line break when first of a line changes
Message ID:
20090215145742.12467.qmail@lists.develooper.com
Telemachus wrote:
> On Sun Feb 15 2009 @  7:25, Jack Butchie wrote:
>> I have a txt file of products that I would like to be able to insert a 
>> blank line whenever the name of the product changes, to make it easier to 
>> read.  I found this srcipt hunting about but I don't know how to apply it 
>> to the text file.

<snip>

> In a nutshell, the script is taking a single filename as an argument,
> opening the file and then checking line n for equality with n-1.

Hence it does not comply with the OP's requirement, i.e. a blank line 
whenever the *product name* changes.

> As a more general rule, I would have to recommend *not* running scripts you
> don't understand that you find floating around on the interwebs. 

Indeed.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

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