The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. Shell Script Page.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
To find multiple strings count in a file salaathi Linux 3 11-28-2007 02:31 AM
Trouble pasting multiple files together!! etownbetty UNIX for Dummies Questions & Answers 2 11-21-2007 04:20 PM
Problem to search multiple strings sudhish Shell Programming and Scripting 2 10-25-2007 11:00 AM
Grepping for strings t4st33@mac.com UNIX for Dummies Questions & Answers 5 06-20-2007 08:51 PM
How to concatenate two strings or several strings into one string in B-shell? fontana Shell Programming and Scripting 2 08-26-2005 08:58 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-14-2008
Registered User
 

Join Date: May 2008
Posts: 7
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Trouble grepping for multiple strings

I am having a heck of a time trying to write a script that will grep for multiple strings in a single file. I am really at my wits end here and I am hoping to get some feedback here.

Basic information:

OS: Solaris 9
Shell: KSH
Oracle Database server

I was trying to grep through a file looking for two certain errors:

ORA-5543
and
ORA-1234

I have tried numerous combinations, but I cannot get it to work. I can get one value to work, but when I try the other, it does not work.


Anyone have some suggestions?
I greatly appreciate it.

TCG
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-14-2008
Registered User
 

Join Date: May 2008
Posts: 7
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Wouldn't you know...just after I post this, I figure it out.

Reply With Quote
  #3 (permalink)  
Old 05-14-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,289
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Code:
grep -e 'ORA-5543' -e 'ORA-1234' logfile
in case anyone reads the thread
Reply With Quote
  #4 (permalink)  
Old 05-14-2008
Registered User
 

Join Date: Feb 2008
Location: New Zealand
Posts: 42
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
or
egrep 'string1|string2' file

cheers
Reply With Quote
  #5 (permalink)  
Old 05-15-2008
Registered User
 

Join Date: May 2008
Posts: 7
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Blah...I forgot to post what I used. My apologies.
Here is what I used:

Code:
egrep -e 'ORA-5543|ORA-1234'
Reply With Quote
  #6 (permalink)  
Old 05-16-2008
Registered User
 

Join Date: Jun 2007
Posts: 285
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Code:
sed -n '/ORA-5543/p;/ORA-1234/p' filename
Reply With Quote
Google UNIX.COM
Reply

Tags
solaris

Thread Tools
Display Modes


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
"inappropriate ioctl for device" 421 service not available, remote server has closed connection ^m autosys awk trim bash eval bash exec bash for loop boot: cannot open kernel/sparcv9/unix close_wait command copy/move folder in unix curses.h cut command in unix dead.letter find grep find null character in a unix file grep multiple lines grep or grep recursive grep unique inaddr_any inappropriate ioctl for device logrotate.conf lynx javascript mailx attachment mget mtime ping port remove first character from string in k shell replace space by comma , perl script scp recursive segmentation fault(coredump) sftp batch sftp script snoop unix stale nfs file handle syn_sent tar exclude unix unix .profile unix com unix forum unix forums unix interview questions unix mtime unix simulator unix.com vi tab size vi+substitute+end+of+line+character while loop within while loop shell script


All times are GMT -7. The time now is 12:05 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101