I have a data file like this:
49960 1157 32390 1227 1268
31 8 21
12 115 18493 67
250 2 2 237704 369658
52 21 312 38 27746 3174
19 160 9 555 6337 6071
43 33
I want to separate the field to three groups, $1 and $2 are the first group, $3 and $4 are the second group, $5 and $6 are the third group. I want output the records that more than two group have a total value>100.
This is my code, and I can't get it. I'm a new guy in shell. Thank you!
#! /bin/awk -f
a=0
b=0
c=0
BEGIN {
FS="\t"
}
{
if ($1+$2 >=100) {
a=1
}
}
{
if ($3+$4 >=100) {
b=1
}
}
{
if ($5+$6 >=100) {
c=1
}
}
END {
if (a+b+c >= 2) {
print $0
}
}
But I get the results.
Thank you!