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
    #1  
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

Code:
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,
Sam.

Last edited by radoulov; 10-27-2011 at 11:10 AM..
Sponsored Links
    #2  
Old 10-27-2011
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
Moderator
 
Join Date: Jan 2007
Last Activity: 1 September 2014, 10:03 AM EDT
Location: Варна, България / Milano, Italia
Posts: 5,667
Thanks: 182
Thanked 617 Times in 575 Posts

Code:
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
    #3  
Old 10-27-2011
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Advisor  
Forum Advisor
 
Join Date: Feb 2005
Last Activity: 2 September 2014, 12:07 AM EDT
Location: Foxborough, MA
Posts: 7,644
Thanks: 150
Thanked 577 Times in 542 Posts

Code:
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 04:34 AM
Grep multiple strings in multiple files using single command gagan4599 UNIX for Dummies Questions & Answers 2 01-19-2011 06:22 AM
grep multiple words in a single line anduzzi Shell Programming and Scripting 11 06-25-2009 11:39 AM
search multiple words using grep pb18798 UNIX for Dummies Questions & Answers 20 08-26-2008 01:43 AM
grep on multiple words to match text template rider29 Shell Programming and Scripting 6 05-23-2008 11:21 AM



All times are GMT -4. The time now is 02:45 AM.