Sponsored Content
Top Forums Shell Programming and Scripting Grep lines for number greater than given number Post 302875865 by meena_2013 on Wednesday 20th of November 2013 03:27:34 PM
Old 11-20-2013
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*************************
Code:
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:
*****************************************
Code:
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?

Last edited by meena_2013; 11-20-2013 at 04:36 PM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

number of lines returned from a grep command

hi all, from a shell (ksh) script, i am doing a 'grep'. how do i find out the number of lines returned from that 'grep' command ?? thanks in advance. (4 Replies)
Discussion started by: cesarNZ
4 Replies

2. Shell Programming and Scripting

Number lines of file and assign variable to each number

I have a file with a list of config files numbered on the lefthand side 1-300. I need to have bash read each lines number and assign it to a variable so it can be chosen by the user called by the script later. Ex. 1 some data 2 something else 3 more stuff which number do you... (1 Reply)
Discussion started by: glev2005
1 Replies

3. Shell Programming and Scripting

count the number of lines that start with the number

I have a file with contents similar to this. abcd 1234 4567 7666 jdjdjd 89289 9382 92 jksdj 9823 298 I want to write a shell script which count the number of lines that start with the number (disregard the lines starting with alphabets) (1 Reply)
Discussion started by: grajp002
1 Replies

4. UNIX for Dummies Questions & Answers

check if a decimal number is greater than zero

Hello, In my code I am checking to see if a variable that contains a decimal number is greater than 0 in the following manner: if do something fi However I am getting the error message (if $i for the current iteration holds 9.6352) command 9.6352 is not found How can I rectify... (5 Replies)
Discussion started by: Gussifinknottle
5 Replies

5. Shell Programming and Scripting

Egrep a greater than number

data: hello mr smith 400 you all ok? hello mrs. smith 700 you all ok? hello mr. everyone 150 you all ok? hello mr. you all 199 im lad you are ok using egrep, how can i grep out only lines that have a number greater than 250? cat data | egrep ..... can't use awk here. i was... (7 Replies)
Discussion started by: SkySmart
7 Replies

6. Shell Programming and Scripting

Grep range of lines to print a line number on match

Hi Guru's, I am trying to grep a range of line numbers (based on match) and then look for another match which starts with a special character '$' and print the line number. I have the below code but it is actually printing the line number counting starting from the first line of the range i am... (15 Replies)
Discussion started by: Kevin Tivoli
15 Replies

7. UNIX for Dummies Questions & Answers

Grep SQL output file for greater than number.

Hi, This is my first post. I have a korn shell script which outputs a select statment to a file. There is only one column and one row which contains a record count of the select statement. The select statement looks something like this: SELECT COUNT(some_field) AS "count_value" ... (2 Replies)
Discussion started by: MurdocUK
2 Replies

8. UNIX for Dummies Questions & Answers

Greater than specific number

please let me know how to construct if then else by comparing two numbers if it is greater than 10000. I need to do some specific task executed. can you help me out in shell scripting plz. (6 Replies)
Discussion started by: ramkumar15
6 Replies

9. Shell Programming and Scripting

How to print N number of lines before and after the grep?

Hi , My record file , need to print up to above (DATA array)(there may be n no lines ) , grep "myvalue" row now .....suggest me some options --- DATA Array--- record type xxxxx sequence type yyyyy 2 3---> data1 /dev/ --- DEVICE --- MAXIMUM_People= data_blocks= MY_value=2 xyz abc ... (0 Replies)
Discussion started by: Huvan
0 Replies

10. UNIX for Beginners Questions & Answers

How to output non-number lines with grep?

I want to check my data quality. I want to output the lines with non-number. I used the grep command: grep '' myfile.csv Since my file is csv file, I don't want to output the lines with comma. And I also don't want to output "." or space. But I still get the lines like the following:... (8 Replies)
Discussion started by: twotwo
8 Replies
shells(4)							   File Formats 							 shells(4)

NAME
shells - shell database SYNOPSIS
/etc/shells DESCRIPTION
The shells file contains a list of the shells on the system. Applications use this file to determine whether a shell is valid. See getuser- shell(3C). For each shell a single line should be present, consisting of the shell's path, relative to root. A hash mark (#) indicates the beginning of a comment; subsequent characters up to the end of the line are not interpreted by the routines which search the file. Blank lines are also ignored. The following default shells are used by utilities: /bin/bash, /bin/csh, /bin/jsh, /bin/ksh, /bin/pfcsh, /bin/pfksh, /bin/pfsh, /bin/sh, /bin/tcsh, /bin/zsh, /sbin/jsh, /sbin/sh, /usr/bin/bash, /usr/bin/csh, /usr/bin/jsh, /usr/bin/ksh, /usr/bin/pfcsh, /usr/bin/pfksh, /usr/bin/pfsh, and /usr/bin/sh, /usr/bin/tcsh, /usr/bin/zsh. Note that /etc/shells overrides the default list. Invalid shells in /etc/shells may cause unexpected behavior (such as being unable to log in by way of ftp(1)). FILES
/etc/shells lists shells on system SEE ALSO
vipw(1B), ftpd(1M), sendmail(1M), getusershell(3C), aliases(4) SunOS 5.10 4 Jun 2001 shells(4)
All times are GMT -4. The time now is 11:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy