notice it didn't grab this line even though it should have:
Notice that the egrep command that hanson44 gave you would have matched both 407 and 74000 on that line.
This is very different from your original request. If what you now want is to select lines with numbers greater than or equal to 500 immediately followed by the string " ms" enclosed in parentheses, that could be done with something like:
This User Gave Thanks to Don Cragun For This Post:
On the web site, I re-edited the original syntax, to correct a typo. If you get this by email, you probably did not get that correction. Here is the correct form:
It changes [1-9] to [0-9] in two places, and actually changes the logic to ">= 250". We could switch 2[5-9][0-9]| to 25[1-9]|2[6-9][0-9] to get > 250 logic.
So it's saying 250-299 OR 300-999 OR 1000-9999
--------------------
I modified the test file a little, to make it easier to tell if working:
With the typo corrected, and adding the "ms" part, it does find the 74000 number, but does not find 74000, because adding "ms" to the regular expression "ties down" one end of the RE.
With the "ms" part is included, the RE could be modified as follows (add +) to work correctly in all cases:
Now the RE is saying "250-299 ms" OR "300-999 ms" OR "1000-9999 ms" OR "10000-99999 ms", etc. etc. etc.
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)
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)
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:... (4 Replies)
i'm aware awk can do what i'm trying to do here. but i cant use awk in this scenario given the circumstance of this box.
but i need to check if a number is a certain column is over a certain value, say for instance, 20.
data:
| 12 | 19 | 2000 | 9029333 |... (11 Replies)
Hi all,
I have a tab-delimited text file of size 10Mb. I am trying to count the number of lines using,
grep -c . sample.txtor
wc -l < sample.txt or
awk 'END {print NR}' sample.txtAll these commands shows the count as 1, which means they are reading only the first header line of the file.... (3 Replies)
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)
Hello all
Im trying to write one liner that will show me results only if the result of the expression is greater then 0
For example:
I do :
find . -name "*.dsp" | xargs grep -c SecurityHandler
the result are :
./foo/blah/a.dsp:0
./foo/blah1/b.dsp:1
./foo/blah2/c.dsp:2... (1 Reply)
I am trying to find all files in a directory whose name has a real number larger then the number I am looking for.
For example:
.
|-- delta.1.5.sql
|-- delta.2.1.sql
|-- delta.2.2.sql
|-- delta.2.3.sql
|-- delta.2.4.sql
`-- delta.2.5.sql
I know my database is at 2.2 so I want an... (2 Replies)
Hello!
I wish to extract the pid where CPU is above 10%
last pid: 22621; load averages: 4.71, 5.04, 5.13 15:08:34
221 processes: 212 sleeping, 2 running, 1 stopped, 6 on cpu
CPU states: %... (3 Replies)