The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 04-21-2008
rubin's Avatar
rubin rubin is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2007
Posts: 321
Quote:
Originally Posted by shalua View Post
Just want to make my question more clear. I want to check if all 3 lines exist or not, meaning an AND condition.

Thanks!!
Give this a try:

Code:
#!/bin/sh
#set -x

filename="your_file"

lineA="ALL MATCHING RECORD COLUMNS MATCHED (Baseline and Regression File)"
lineB="Total Mismatched Records (Baseline File): 0"
lineC="Total Mismatched Records (Regression File): 0"


if grep "$lineA" "$filename" && grep "$lineB" "$filename" && grep "$lineC" "$filename"
then
echo "Match"  >> reg_email_body
else
echo  "There is a mismatch"  >> reg_email_body
fi