正则逻辑式逻辑运算符:大于小于不等于 及 和 或运算
[Oracle@bys3 ~]$ cat awktest.log
MMAN started with pid=9, OS id=22862
DBW0 started with pid=10, OS id=22866
LGWR started with pid=11, OS id=22870
CKPT started with pid=12, OS id=22874
SMON:started with pid=13, OS id=22878
RECO:started with pid=14, OS id=22882
显示$5==10||$9>22880 $5等于10或者$9>22880的行
[oracle@bys3 ~]$ cat awktest.log |awk -F'[,= :]' '$5==10||$9>22880 {print $5"\t" $9}'
10 22866
14 22882
显示$5>10&&$9>22880 $5大于10并且$9>22880的行
[oracle@bys3 ~]$ cat awktest.log |awk -F'[,= :]' '$5>10&&$9>22880 {print $5"\t" $9}'
14 22882
显示$5!=10 $5!=11 不等于10并且不等于11的行
[oracle@bys3 ~]$ cat awktest.log |awk -F'[,= :]' '$5!=10&&$5!=11 {print $5"\t" $9}'
9 22862
12 22874
13 22878
14 22882
如果print ($5 > 12 ? 这里如果判断$5 > 12是否为真,真则显示冒号前的值,如果不为真,则显示冒号后值
[oracle@bys3 ~]$ cat awktest.log |awk -F'[,= :]' '{print ($5 > 12 ? "ok \t"$5: "error\t"$5)}'
error 9
error 10
error 11
error 12
ok 13
ok 14