Re: delete blank lines from text file

2012-10-01 Thread Chris Stinemetz
On Mon, Oct 1, 2012 at 3:34 AM, Irfan Sayed wrote: > hi, > > i need to delete all blank lines from the text file > > I usually just skip the blank lines when I read the data one line at a time. Then you can print to a new file. My example is below: #!/usr/bin/perl use 5.010; use strict; use war

Re: delete blank lines from text file

2012-10-01 Thread Irfan Sayed
thanks a lot ! will improve the coding standard. regards, irfan From: Shlomi Fish To: Irfan Sayed Cc: Perl Beginners Sent: Monday, October 1, 2012 4:08 PM Subject: Re: delete blank lines from text file Hi Irfan, On Mon, 1 Oct 2012 01:34:51 -0700 (PDT

Re: delete blank lines from text file

2012-10-01 Thread Shlomi Fish
Hi Irfan, On Mon, 1 Oct 2012 01:34:51 -0700 (PDT) Irfan Sayed wrote: > hi, > > i need to delete all blank lines from the text file > How do you define a blank line? Is it an empty line? Is it a line that contains only whitespace? In any case, here are a few comments on your code and after

Re: delete blank lines from text file

2012-10-01 Thread Kuldeep Dhole
Hi, I can suggest an algo 1) read a file into an array : file -> @array 2) @array = grep defined, @array (this removes all the blank values from an @array) 3) write array again back to file kind regards, Kuldeep On Mon, Oct 1, 2012 at 2:04 PM, Irfan Sayed wrote: > hi, > > i need to delete all

delete blank lines from text file

2012-10-01 Thread Irfan Sayed
hi, i need to delete all blank lines from the text file wrote following code. however, all the blank lines are not getting deleted. please suggest open FILE,"+<", 'C:\Users\bvcontrolbuild\Desktop\test.txt';  while ()    {     chomp;     push (@lines, "$_\n");    }   close F