Hi drl,
Thanks for the reply.
Now i see this as easier implementation compared to others.
Unfortunately,I just realized that the results expected is not what I expected at the first place. Sorry for that

I just get confused.
Instead it is supposed to be in a.txt;each element is compared separated to b.txt at one time (b.txt is multiple text file which varies across different directories).
To give a bigger picture, a.txt contain all the elements to compare with different file of b.txt.
Can we still use join in this case?
Example:-
Input files:
a.txt
aaa 107
bbb 108
ccc 109
b.txt
101 2 1
102 3 1
107 2 1
108 3 1
109 2 1
b.txt
101 2 1
102 3 1
107 2 1
108 4 2
109 2 1
b.txt
101 2 1
102 3 1
107 2 1
108 4 2
109 6 1
At one time, each line of a.txt is read starting with "aaa 107" is match with elements in b.txt. Next, second line of a.txt which is "bbb 108" is match with elements in another file of b.txt which can be similar to earlier b.txt.
Ultimately, I would think your idea of join is great where it would be nice if
every element of a.txt could be joined with matching element in different b.txt file.
Desired output would be :-
aaa 107 2 1
bbb 108 4 2
ccc 109 6 1
I am so sorry for the earlier confusion of the intended otuput i would liek to see.Please advise.
Thanks.
-Jason