Visit Our UNIX and Linux User Community

issues with egrep

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting issues with egrep
# 1  
Old 07-30-2009
issues with egrep


I have my data something like this

(07/29/2009 00:23:34 567) Port search parameters zzzzzzzzzzzzz
(07/29/2009 00:23:34 567) Processed 12345678 ababaababab
(07/29/2009 00:23:34 567) Port search parameters ccccccccccc
(07/30/2009 00:23:34 567) processed 23567412 vvvvvvvvvvvvv
(07/30/2009 00:23:34 567) Port search parameters zzzzzzzzzzzzz

I need to get today's data with keyword 'Port search parameters' or 'processed'
I am using egrep to get the keywords as shown below.

i have assigned today's date to the varialble today
egrep $today.*'Port search parameters|processed' filename

The above code is not working and giving an error that egrep can't serach 'Port search parameters|processed'
Is there any issue with the egrep format overe here? or any other alternative for getting today's data with required keywords x or y. Please help
# 2  
Old 07-30-2009
 egrep "$today*.*Port search parameters|$today*.*processed"  file

# 3  
Old 07-30-2009
Try this:

egrep "$today" filename | egrep 'Port search parameters|Processed'


Previous Thread | Next Thread
Test Your Knowledge in Computers #300
Difficulty: Easy
The basis for the first versions of the Slackware Linux distributions was Debian Linux.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting


Hi I am trying to run CMD that combining EGREP and PERL in multiple files cat *07:00.22-12-13.txt | egrep" NAME| perl -ne 'print if /^sid9/ .. /^!/' " I need the see the NAME and the text from sid9 to ! how can I use the EGERP in parallel to the PERL ? This is one file Qqq... (2 Replies)
Discussion started by: sharong
2 Replies

2. Shell Programming and Scripting

egrep help

hi, i'm using egrep -i to search thru some text files for keywords (also stored in a file). egrep does wildcard search aka %keyword% as long as the keyword is found, it will be spool to a file meaning if keyword is 'xyz' 123 aabgdggjxyzslgj 124 xyzgjksgjd returns 123... (8 Replies)
Discussion started by: bing
8 Replies

3. UNIX for Dummies Questions & Answers

search ")" with egrep - egrep: syntax error

Hi Guys, we have a shell script which basically query the Database which retrieves huge data and use the data with "egrep" . Now there is some data which contains characters like "abc)" and the same is used like below : "egrep (.+\|GDPRAB16\|GDPR/11702 96 abc)\|$ temp.txt" now while... (7 Replies)
Discussion started by: sagarjani
7 Replies

4. UNIX for Dummies Questions & Answers


HI, I want to grep the contents of fileb from filea. filbeb 5x4xxx371x31a43 4x40x037103a049 3x4x003710a0659 4x4x0x371a50912 filbea 5x4xxx371x31a43 3266000225 4x4003266000277 3266000277 4x400326x000499 3266000499 4x4003266000676 3266000676 4x4x0x371a50912 3266000777... (4 Replies)
Discussion started by: krao
4 Replies

5. UNIX for Dummies Questions & Answers


what does "egrep """ do ?? Can anyone explain this with an example .. please .. (2 Replies)
Discussion started by: risshanth
2 Replies

6. Shell Programming and Scripting

help on egrep

Hi there, How many multiple values can be in egrep for seraching? i am giving more values but i am getting the error like Unknown error. My input in extended to 2nd line. my command is like below. egrep -i -h... (2 Replies)
Discussion started by: arund_01
2 Replies

7. Shell Programming and Scripting


Hi, I don't understand what is the correct way of writing: egrep -l '{$min,$max} $pattern' $filename I tryed to search on google how to wtrite {$min, $max}, but I don't have success (7 Replies)
Discussion started by: DNAx86
7 Replies

8. UNIX for Dummies Questions & Answers

Egrep cheat sheet anywhere? Looking for meaning of egrep -c

Hi I've been searching google and have not found what egrep -c means. Does anyone know where I can get a cheat sheet or what that -c means? thanks, Linda (2 Replies)
Discussion started by: leelm
2 Replies

9. Shell Programming and Scripting

egrep help

How can i make something like if (echo "$arg2" | egrep -s '^+\.+km/h+$|^+km/h+$'); then not to output the value of $arg2 on the screen, evertime i get match it outputs the value of the variable on the screen which i don't need to do. I know for grep its -q option but it doesn't work for egrep.... (2 Replies)
Discussion started by: Vozx
2 Replies

10. UNIX for Dummies Questions & Answers

egrep -f

Hi, i am using egrep -f. The file with the expressions is very big and if i make the file a lot smaller, it works fine. Only if i use the original file, witch has about 20.000 lines it doesn't seem to work. Is the file to big, or do i need more patience?? my command is: egrep -f... (2 Replies)
Discussion started by: tine
2 Replies

Featured Tech Videos