TBS.log
我有一个这样的文件
SYSAUX 70.12
SYSTEM 81.74
UNDOTBS1 5.66
UNDOTBS2 1.93
UNDOTBS3 1.79
USERS .16
我需要得到如下输出。如果第二列大于 70,则应打印成功消息,否则应打印失败消息例如
SUCCESS: SYSAUX > 70%
FAILURE: UNDOTBS1 < 70%
它应该读取每一行并给出成功或失败消息
答案1
awk '{
if ($2+0 > 70)
print "SUCCESS:", $1, "> 70%";
else
print "FAILURE:", $1, "<= 70%";
}' TBS.log
SUCCESS: SYSAUX > 70%
SUCCESS: SYSTEM > 70%
FAILURE: UNDOTBS1 <= 70%
FAILURE: UNDOTBS2 <= 70%
FAILURE: UNDOTBS3 <= 70%
FAILURE: USERS <= 70%