awk - How to filter on column value in bash -
i'm facing problem while trying grep
(filter) logfile on value of integer.
logfile.log:
2014-11-16 21:22:15 8 10.133.23.9 proxied ... 2014-11-16 21:22:15 1 163.104.40.133 authentication_failed denied ... 2014-11-16 21:22:15 15 163.104.40.134 authentication_failed denied ... 2014-11-16 21:22:16 9 163.104.124.209 proxied ...
i have int in column 3 : 8
, 1
, 15
, 9
.
i need grep if: value > 10
.
something like:
cat logfile.log | grep {$2>10} 2014-11-16 21:22:15 15 163.104.40.134 authentication_failed denied ...
this should make!
$ awk '$3>10' file 2014-11-16 21:22:15 15 163.104.40.134 authentication_failed denied ...
with $3
refer 3rd field, $3>10
means: lines having 3rd field bigger 10. if accomplished, condition true , hence awk
performs default behaviour: print line.
you of course say: print specific field, saying awk '$3>10 {print $1}' file
, example.
Comments
Post a Comment