System Administration & Network Administration
shell-scripting
Updated Wed, 20 Jul 2022 06:38:54 GMT

grep from file based on the integer value


How can I get details of the page that taking more than 10000 sec.

15:39:22,507NTP=/a/file/fname.pageTime=20559
15:40:10,811NTP=a/file/fname.pageTime=134
15:42:24,488NTP=a/file/fname.pageTime=10153
15:42:24,488NTP=a/file/fname.pageTime=10000
15:42:24,488NTP=a/file/fname.pageTime=101

I want to Out put as below as it is taking more than 10000 sec:

15:39:22,507NTP=/a/file/fname.pageTime=20559
15:42:24,488NTP=a/file/fname.pageTime=10153



Solution

I know you said "grep", but here's an awk variation anyway. Try

awk -F 'pageTime=' '{ if ($2 > 10000) print $0 }' /path/to/your/logfile