grep by limit search


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting grep by limit search
# 1  
Old 09-18-2011
grep by limit search

Hi
I am in new in unix,can any one tell how to grep the data by limit.
suppose I have below data:-

is :[1249]mSecs
is :[585]mSecs
is :[160]mSecs
is :[50]mSecs

requirement is how to grep the data which is having count greater than 1000 msecs only.

thanks in adnavce.
# 2  
Old 09-18-2011
Code:
$ echo "is :[1249]mSecs
is :[585]mSecs
is :[160]mSecs
is :[50]mSecs" | awk -F"[][]" '$2>1000{print}'
is :[1249]mSecs

Code:
awk -F"[][]" '$2>1000{print}' inputfile


Last edited by itkamaraj; 09-18-2011 at 07:43 AM..
# 3  
Old 09-18-2011
Code:
grep '\[[0-9]\{4\}' infile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use a grep search to search for a specific string within multiple directories?

Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried: grep -lr "this string" * but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies

2. UNIX for Beginners Questions & Answers

Grep/awk using a begin search pattern and end search pattern

I have this fileA TEST FILE ABC this file contains ABC; TEST FILE DGHT this file contains DGHT; TEST FILE 123 this file contains ABC, this file contains DEF, this file contains XYZ, this file contains KLM ; I want to have a fileZ that has only (begin search pattern for will be... (2 Replies)
Discussion started by: vbabz
2 Replies

3. Shell Programming and Scripting

Grep string search

Hi All, I'm using aix flavour unix where im trying for the below kind of pattern to search in all the files in a directory. I tried with different possible combinations like grep -ir "out.*\transaction_ctry_code" * etc.... Pattern I'm trying for : out<any thing>country_cd Here i... (0 Replies)
Discussion started by: rmkganesh
0 Replies

4. Shell Programming and Scripting

Grep for search.

hi, i got files delimited by |^ character. eg. apple|^ball|^cat|^dog|^egg i need to find if the above file contains | (pipe ) character inside the data.eg. apple|^ball|^cat|^d|og|^egg. above file contains | character in the dog data. how can i search that. (4 Replies)
Discussion started by: krk
4 Replies

5. Shell Programming and Scripting

Find files and seach limit with grep

Hi, I'm testing nginx-cache-purge and notice that grep searches all file content, and since the cache key is in the second line I would like to limit grep searching. This is the script I'm using: github.com/perusio/nginx-cache-purge The line I would like to change and limit grep search... (5 Replies)
Discussion started by: nfn
5 Replies

6. Solaris

Limit: stacksize: Can't remove limit

Hi all, I'm using to Solaris machine. When I run a simple script this messenger come out:"limit: stacksize: Can't remove limit". Any one know the way to resolve this problem without reboot the machine? Thanks in advance. (3 Replies)
Discussion started by: Diabolist9
3 Replies

7. Shell Programming and Scripting

sed: how to limit pattern search to first instance only

I need to reduce a file's size below 50MB by deleting chucks of text. The following sed does this. sed '/^begpattern/,/endpattern/d' myfile However, it's possible that the file size can get below 50MB by just deleting the first instance of the pattern. How do I code that into sed? Or can awk... (8 Replies)
Discussion started by: mariod1049
8 Replies

8. Shell Programming and Scripting

search using grep

Hi all, I have a folder with many files. I need to get all the filenames with the value "<f id=audio-time>*:*:*</f>" word. * may be any integer. I used find . -type f -exec grep -H '<f id=audio-time>.:.</f>' {} \; command to get. but i am not able to find the correct values. Any... (2 Replies)
Discussion started by: ananthi_ku
2 Replies

9. UNIX for Advanced & Expert Users

How to limit the search to 'n' occurrences within a line

Hello All, I am trying to search one pattern across a file and then print it. But i need to delimit the search per line to 2 occurrences. How do i do that? Regards. (9 Replies)
Discussion started by: Linuxee
9 Replies

10. Shell Programming and Scripting

grep line length limit

Hi Friends, I am having a funny problem with grep. When I run grep 'expr' file.txt things work fine. But when try to get the line number using the -n option, i.e, grep -n 'expr' file.txt I get a message, "grep: 0652-226 Maximum line length of 2048 exceeded." If the line has more than... (3 Replies)
Discussion started by: hnhegde
3 Replies
Login or Register to Ask a Question