Hello,
I have 2 csv files:
File1:
Name,year,organization
Jim,2007,Org1
Bob,1999,Org3
Chris,2001,Org2
File2:
DocumentName,DocumentTitle,organization,year
Test1,Test1,Org1,2007
Test2,Test2,Org2,2008
Test3,Test3,Org3,2009
Using the ksh, I'm reading by line and grabbing the value in the 2nd column ($2). I want to use this value and search the second file to find a line with a match. If it is found I want to grab the value of column 1 ($1) of the second file during that read
while readline
do
if test $i -ge 1;
then
echo "$line" awk '{print $1","$2}' >> File3
now use $2 to search File2 for a match
if found print the value of $1 in File2 to File3 fi
done < $File1
Result
Jim,2007,Test1
Can anyone give me some insight as to how this can be done?
thanks