Hi vgersh99,
The printing is only for display purposes to see how many partner names does the metadata file has...
I am sorry for the miscommunication.
Sample Input File1 (Metadata File)
Sample Input File2 (Detail File)
The Metadata File has names such as ORBITZ, BESTWESTERN and so on. They should also exist in the Detail File. A comparison needs to be made. Incase, they don't exist the script should fail.
The current code cuts the names and puts that into a temporary file. Then it loops and checks the
existence of these names in the Detail file. If any of the names doesn't exist, then the
script should abort.
I am getting confused about the looping process here...Is this the right way to work through the solution?
Moreover, the detail file in reality has 13 million records.
PHP Code:
#!/usr/bin/ksh
# put the second column into a file,
# make it unique values
awk '{ print $2 } ' file1 | sort -u > patternfile
# loop thru the patterns from file1
# look for them in file2
while read pattern1
do
grep "$pattern1" file2
rc=$?
if [ ${rc} -eq 0 ]; then
echo "Pattern found in file2 -- Successful"
else
echo "Pattern "$Pattern" not found in file2, Failed"
fi
done < patternfile
Also attached are the sample files...
Sample Metadata file
M
ORBITZ 8 LAST_BOOKED_DATE D
M
AIRTRAN 8 TRIPS_YTD A 11
M
FRONTIER 5 FLT_COUNT N
M
CAESAR 7 DAYSPLAYED A 9
M
BESTWESTERN 4 ACTIVITY_CNT_L12 A
Sample Detail file
D
BESTWESTERN FIRST LAST 10545 WILLOWS RD NE
D
ORBITZ FIRST LAST 550 N CENTRAL ROWIE AZ
D
AIRTRAN FIRST LAST 6755B WILLOW BROOK PARK # P
D
FRONTIER FIRST LASTNAME PO BOX 370
D
CAESAR FIRST LAST 2113 CRIMSCENDDR # 10
I hope I am clear this time...