Hi All,
I have two files
file1:
abc,def,ghi,5,jkl,mno
pqr,stu,ghi,10,vwx,xyz
cba,ust,ihg,4,cdu,oqw
file2:
ravi,def,kishore
ramu,ust,krishna
joseph,stu,mike
I need two output files as follows
In my above example, each row in file1 has 6 fields and each row in file2 has 3 fields. I should compare field2 in both the files. If field2 is same in both the files then i should get the third field in file2 as the last field in file1.
output:
abc,def,ghi,5,jkl,mno,kishore
pqr,stu,ghi,10,vwx,xyz,mike
cba,ust,ihg,4,cdu,oqw,krishna
Also, If field3 in file1 is same as field3 in the next line then the field4 should add upto field4 in the next line and i should get a unique output as follows
ouput:
abc,def,ghi,15,jkl,mno
cba,ust,ihg,4,cdu,oqw
can somebody please help me with this as i require it pretty urgently. I am using sun solaris. If we can get the output using sed or awk that would be great. Any other way is also appreciated.
Thanks in advance..........