Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have to check whether all the values from 3rd column is 0 or not. If all the values are zero, then delete the line.#!/usr/bin/perl open FH,'test.tsv'; @data=<FH>; $len=scalar (@data); for($i=1;$i<=$len;$i++){ print $data[$i]; }
i.e from name1. if in a file all the values are zero then I should delete the entire file. from the above example, the output file should have the row:id date name1 name2 namen 123 2010-02-23 0 0.00 0 1234 2010-02-24 0 3 0
id date name1 name2 namen 1234 2010-02-24 0 3 0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Delete the line
by Utilitarian (Vicar) on Jul 21, 2010 at 09:55 UTC | |
|
Re: Delete the line
by Anonymous Monk on Jul 21, 2010 at 09:30 UTC | |
| |
|
Re: Delete the line
by Ratazong (Monsignor) on Jul 21, 2010 at 09:41 UTC | |
|
Re: Delete the line
by moritz (Cardinal) on Jul 21, 2010 at 09:40 UTC | |
|
Re: Delete the line
by jethro (Monsignor) on Jul 21, 2010 at 09:41 UTC | |
|
Re: Delete the line
by matrixmadhan (Beadle) on Jul 22, 2010 at 03:12 UTC | |
|
Re: Delete the line
by JavaFan (Canon) on Jul 23, 2010 at 16:01 UTC |