Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Grep multiple words in a single file

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 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 Unix and Linux 10-27-2011
radoulov's Unix or Linux Image
radoulov radoulov is offline Forum Staff  
Moderator
 
Join Date: Jan 2007
Last Activity: 23 April 2015, 3:05 PM EDT
Location: Варна, България / Milano, Italia
Posts: 5,690
Thanks: 184
Thanked 624 Times in 582 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 Unix and Linux 10-27-2011
vgersh99's Unix or Linux Image
vgersh99 vgersh99 is offline Forum Advisor  
Forum Advisor
 
Join Date: Feb 2005
Last Activity: 25 April 2015, 7:43 AM EDT
Location: Foxborough, MA
Posts: 7,808
Thanks: 172
Thanked 647 Times in 605 Posts

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

Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image 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 08:30 AM.