Egrep problem


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Egrep problem
# 1  
Old 01-23-2015
Egrep problem

Hi everyone,

Can someone look this over?

Code:
find /oracle/diag/rdbms/*/*/trace -type f -name '*d00*.trc' -mtime 0  \
      -exec egrep  -c  'TNS-12535: TNS:operation timed out' '{}' '+' | 
         awk -F: '{print $1}' | 
         egrep -c '2015-01-22'  usidp/trace/abcdef_d001_21751.trc:9 \
/oracle/diag/rdbms/abcdef/abcdef/trace/abcdef_d000_21750.trc:22

Inside the 21751 file there is 1 2015-01-22 string. In the 21750 file there are 5 strings of 2015-01-22.

This part of the code works correctly up to the highlighted red part but I am not sure how to pass the awk corrected sting into egrep. The awk corrected string removes the :number off the end of the string providing only the string. It always returns 0 which is not true. The egrep -c '2015-01-22' should return stringname:1 and stringname:5. I reviewed these logs and that is what is in there.

Can someone please take a look at this?

Thanks in advance.

Last edited by jim mcnamara; 01-23-2015 at 05:23 PM.. Reason: Reformat
# 2  
Old 01-23-2015
You have stuff "smashed' together - apparently without meaning.

You have a big XY problem, it seems to me. Forget the code completely for a minute.
Tell us what you want to accomplish, not how to code it.

1.Give us sample input
2. Give us expected output from #1

Thanks.

XY problem: XyProblem - Greg's Wiki
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with egrep and cat

Hello, I want to find some keywords in a dd image. I have created a keyword file (1.txt) and search the dd image using, cat /media/sdb1/test/c.dd.001 | strings | egrep -i --color -f 1.txt It works, But how can I get the file name and path? Many thanks. (7 Replies)
Discussion started by: yzy9951
7 Replies

2. UNIX for Dummies Questions & Answers

Problem pattern redundancy with egrep

%%%%% (2 Replies)
Discussion started by: lucasvs
2 Replies

3. Shell Programming and Scripting

Formatting problem with cat, egrep and perl

Hi guys I'm using the following script to change input file format to another format. some where I'm getting the error. Could you please let me know if you find out? cat input.txt|egrep -v ‘^#'|\ perl -ane ‘if (@F>3){$_=~/(chr.+):(\d+)\ s()/;print $1,”\t”,$2,”\t”,($2+35),”\n”}'\ > output.bed ... (1 Reply)
Discussion started by: repinementer
1 Replies

4. Shell Programming and Scripting

Problem using egrep: spaces and newline

Hello: I am working in bash and am a newbie. I want to eliminate spaces from strings. Since this is a basic operation, I searched online and implemented the suggestions; however, I am facing a problem here. I have an input file which looks like this: abc defghi jklmno pqrs tuvw xyzabcd... (8 Replies)
Discussion started by: andyu11
8 Replies

5. Shell Programming and Scripting

egrep problem

Hello Experts, I am trying to parse a gz file like this gzip -cd filename | xargs egrep -h -e '.*somepattern</TAG>' | grep -c '<TAG2>`date '+%Y-%m-%d'`</TAG2>' But I am getting an error : egrep cant open. Any ideas fellas? (1 Reply)
Discussion started by: King Nothing
1 Replies

6. 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

7. UNIX for Dummies Questions & Answers

egrep

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

8. Shell Programming and Scripting

egrep problem | printing next line?????

Hi !!! Dear People, Please help me with the following problem. consider this output: Top 5 Timed Events ~~~~~~~~~~~~ Total Event Waits Time (s) Ela Time ---------------------------- ------------ ----------- ----- CPU time ... (3 Replies)
Discussion started by: user__user3110
3 Replies

9. Shell Programming and Scripting

egrep understanding problem

Hi, Can anyone please let me know the meaning of this line,i am not able to understand the egrep part(egrep '^{1,2}).This will search for this combination in beginning but what does the values in {}signifies here. /bin/echo $WhenToRun | egrep '^{1,2}:$' >/dev/null (1 Reply)
Discussion started by: namishtiwari
1 Replies

10. 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
Login or Register to Ask a Question