Hi All,
I am trying to check if if column 5 is greater than 90. If greater it will print the term in column 6, else if all are within limit, then it will output "Size is within limit". I can't seem to do that with the below code. The output should only be 1 statement of "Size is within the limit" since all column 5 numbers are less 90. Can somebody advise me what's wrong with my code ?
Input:
/aaa 0 0 0 0 /zzz
/aaa 240553 145567 70931 68 /
/aaa 1170399 800131 311749 72 /qqq
zz 0 0 0 0 /rrr
/xxx 288445 139404 120197 54 /ttt
/xxx 6048174 1946727 4040966 33 /ggg
/xxx 336337 225215 77489 75 /uuu
/xxx 8813861 2025333 6700390 24 /ooo
zzz 496704 35864 460840 8 /ppp
aaa 3073262 1757331 1254466 59 /hhh
aaa 140074829 106235104 32438977 77 /lll
ddd 6048174 1946727 4040966 33 /vvvv
ddd 140074829 106235104 32438977 77 /nnn
BEGIN {}
{
if ($5 > 90) Dir = $6; printf("%5s is over 90%.Pls take note!\n",Dir);
if ($5 < 90) printf("Size is within Limit.\n");
}
END{}
My Output from the above code:
$ nawk -f awk_proto sys_info2.txt
is over 90%.PPls take note!
Size is within Limit.
is over 90%.PPls take note!
Size is within Limit.
is over 90%.PPls take note!
Size is within Limit.
is over 90%.PPls take note!
Size is within Limit.
is over 90%.PPls take note!
Size is within Limit.
is over 90%.PPls take note!
Size is within Limit.
is over 90%.PPls take note!
Size is within Limit.
is over 90%.PPls take note!
Size is within Limit.
is over 90%.PPls take note!
Size is within Limit.
is over 90%.PPls take note!
Size is within Limit.
is over 90%.PPls take note!
Size is within Limit.
is over 90%.PPls take note!
Size is within Limit.
is over 90%.PPls take note!
Size is within Limit.