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

Re: Add Line break when first of a line changes

Thread Previous | Thread Next
Gunnar Hjalmarsson
February 15, 2009 06:57
Re: Add Line break when first of a line changes
Message ID:
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.


> 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. 


Gunnar Hjalmarsson

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About