Grep multiple words in a single file | Unix Linux Forums | Shell Programming and Scripting

  Go Back    

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

Grep multiple words in a single file

Shell Programming and Scripting

Closed Thread    
Thread Tools Search this Thread Display Modes
Old 10-27-2011
samfisher samfisher is offline
Registered User
Join Date: Oct 2011
Last Activity: 27 October 2011, 11:20 AM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Grep multiple words in a single file

Hello All,

I'm a newbie/rookie in Shell scipting. I've done oracle export of a table using Export utility. When I do export, it generates 2 files.
1> .dmp file
2> .dmp.log file.

In .dmp.log file I have to search for a sentence which goes like '0 records have been inserted' and then I've to check for 'Export terminated succesfully without warnings'.
For a single sentence I can do

grep 'Export terminated succesfully without warnings'. filename.dmp.log

Could you please help me how to find multiple sentences. I'm not sure if we could use compound statement here.

Thank you,

Last edited by radoulov; 10-27-2011 at 12:10 PM..
Sponsored Links
Old 10-27-2011
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
Join Date: Jan 2007
Last Activity: 27 January 2015, 7:26 AM EST
Location: Варна, България / Milano, Italia
Posts: 5,675
Thanks: 184
Thanked 620 Times in 578 Posts

grep -E 'Export terminated succesfully without warnings|0 records have been inserted' filename.dmp.log

Some grep implementations don't support the standard -E option,
if the command above doesn't work, try using egrep , instead of grep -E .
Sponsored Links
Old 10-27-2011
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Advisor  
Forum Advisor
Join Date: Feb 2005
Last Activity: 28 January 2015, 8:55 AM EST
Location: Foxborough, MA
Posts: 7,704
Thanks: 161
Thanked 606 Times in 567 Posts

egrep '(0 records have been inserted|Export terminated succesfully without warnings)' myLogFile

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
grep words from output file darling Shell Programming and Scripting 5 06-29-2011 05:34 AM
Grep multiple strings in multiple files using single command gagan4599 UNIX for Dummies Questions & Answers 2 01-19-2011 07:22 AM
grep multiple words in a single line anduzzi Shell Programming and Scripting 11 06-25-2009 12:39 PM
search multiple words using grep pb18798 UNIX for Dummies Questions & Answers 20 08-26-2008 02:43 AM
grep on multiple words to match text template rider29 Shell Programming and Scripting 6 05-23-2008 12:21 PM

All times are GMT -4. The time now is 10:11 AM.