Grep lines for number greater than given number

Hello,
I am newbie to bash scripting. Could someone help me with the following.
I have log file with output as shown below
**************************LOG*************************

11/20/2013  9:11:23.64 Pinging xx.xx.xx.xx with 32 bytes of data:
11/20/2013  9:11:23.64 Reply from xx.xx.xx.xx: bytes=32 time=62ms TTL=125
11/20/2013  9:11:23.64 Reply from xx.xx.xx.xx: bytes=32 time=41ms TTL=125
11/20/2013  9:11:23.64 Reply from xx.xx.xx.xx: bytes=32 time=57ms TTL=125
11/20/2013  9:11:23.64 Reply from xx.xx.xx.xx: bytes=32 time=78ms TTL=125
11/20/2013  9:11:23.64 Reply from xx.xx.xx.xx: bytes=32 time=60ms TTL=125
11/20/2013  9:11:23.64 Reply from xx.xx.xx.xx: bytes=32 time=56ms TTL=125
11/20/2013  9:11:23.64 Ping statistics for xx.xx.xx.xx:
11/20/2013  9:11:23.64 Packets: Sent = 6, Received = 6, Lost = 0 (0% loss),
11/20/2013  9:11:23.64 Approximate round trip times in milli-seconds:
11/20/2013  9:11:23.64 Minimum = 41ms, Maximum = 78ms, Average = 60ms 

**************************LOG*************************
I' m trying to grep for lines of an output with time >=60ms.

Desired output:
*****************************************

11/20/2013  9:11:23.64 Reply from xx.xx.xx.xx: bytes=32 time=62ms TTL=125
11/20/2013  9:11:23.64 Reply from xx.xx.xx.xx: bytes=32 time=60ms TTL=125
11/20/2013  9:11:23.64 Reply from xx.xx.xx.xx: bytes=32 time=78ms TTL=125

*****************************************
Any ideas how this could best be accomplished?

Try:

grep -E 'time=([0-9]{3,}|[6-9][0-9])ms' file

or something like

awk -Ftime= '$2+0>=60' file
1 Like

Both worked perfectly for what I needed, thanks! :slight_smile:

Hello,

Following may also help.

awk '!/\=[6-9][0-9]/ {next}1' file_name

Output will be as follows.

11/20/2013  9:11:23.64 Reply from xx.xx.xx.xx: bytes=32 time=62ms TTL=125
11/20/2013  9:11:23.64 Reply from xx.xx.xx.xx: bytes=32 time=78ms TTL=125
11/20/2013  9:11:23.64 Reply from xx.xx.xx.xx: bytes=32 time=60ms TTL=125

Thanks,
R. Singh

@ravinder: that would be equivalent to awk '/\=[6-9][0-9]/' . It would not work for values that are >=100 and also the value of TTL could distort the outcome..