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 -->
  #2 (permalink)  
Old 07-01-2009
prasperl prasperl is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 22
Try this!

try this

for i in `cat map | awk 'BEGIN { FS = " " }; { print $1}'`
do
mapkey1=$i
mapkey2=`cat map | grep $mapkey1 `
mapkey2=`echo $mapkey2 | awk 'BEGIN { FS = " " }; { print $2}'`
file1key=`cat file1 | grep $mapkey2`
file1key=`echo $file1key | awk 'BEGIN { FS = " " }; { print $2,$3}'`
file2key=`cat file2 | grep $mapkey1`
file2key=`echo $file2key | awk 'BEGIN { FS = " " }; { print $2,$3}'`
echo $i $file1key $file2key
done


map - your map file
file1 - your file1_toJOIN
file2 - file2_toJOIN:

The o/p i got is :
job1 22:00:00 23:00:00 dan 18
job2 09:40:00 10:12:00 tom 22
job3 12:00:03 15:00:09 kim 20
job4 10:30:00 11:00:00 jim 25