Print rows with value zero or less than zero using awk

I tried this. It working fine for small tables. But it is giving values greater than zero in a big file with 8556 columns. Does any one know why ?

awk 'FNR == 1{print;next}{for(i=8556;i<=NF;i++) if($i <= 0){print;next}}' input

What are you trying with this ?

want to print rows that has zeroes

na t1  t2  t3  t4  t5  t6  t7
l1  0  0  0  0  0  0  0

---------- Post updated at 12:28 PM ---------- Previous update was at 11:53 AM ----------

real example

g
g1      0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000    0.000000 0.000000        0.344063        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000    0.000000 0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000    0.000000 0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000    0.000000 0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000    0.000000 0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000    0.000000 0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.216579        0.000000        0.000000        0.000000    0.000000 0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.000000        0.00000

Still ambiguous, this is how i understand

  1. ignore header
  2. space as seperator
  3. print rows which has any column as zero
awk 'FNR>1{for(i=1;i<=NF;i++){ if($i==0){print ; next; } }}' fileName.txt

Sorry. here is the proper explanation. Based on below explanation the input shuldn't be pinted.

1. ignore header
2. space as tab
3. print rows which has all column as zero 

How about

awk 'FNR>1  {for(i=2; i<=NF; i++) if($i!=0) next } 1' file
1 Like