problen with a join under AIX

Hello,

I have a script shell under aix with a join of 2 files
fic2.txt :
test100:zone 1 :zone 2:zone 3
test10:zone 1:zone 2:zone 3
test:zone 1:zone 2:zone 3
fic3.txt:
test100:zone 4:zone 5
test10:zone 4:zone 5
test:zone 4: zone 5

and the command : join -11 -21 -t: fic2.txt fic3.txt

gives back only the line
test100:zone 1 :zone 2:zone 3:zone 4:zone 5

and not the lines
test100:zone 1:zone 2:zone 3:zone 4:zone 5
test10:zone 1:zone 2:zone 3:zone 4:zone 5
test:zone 1:zone 2:zone 3:zone 4:zone 5
like I was waiting for. Why ???? Do you have a solution ?

Thanks for your answers

Thierry

In Linux join command is working fine. I don't AIX platform to check so that Lets try with awk command as,

awk '{ getline var < "./test1";print var" "$2" "$3 }' test2

Where test1 is the first file and test2 is second file.

Check this.

HTH.

Hi muthukumar,

Thanks for your answer, but it don't works. I have, effectively 3 lines corresponding, but I have lost a part of fic3 (the word 'zone')

test100:zone 1 :zone 2:zone 3 4:zone 5
test10:zone 1:zone 2:zone 3 4:zone 5
test:zone 1:zone 2:zone 3 4: zone

And more, this is an example, but the original file fic2 may have differents lines like the following

test100:zone 1 :zone 2:zone 3
test100:zone11:zone22:zone33
test10:zone 1:zone 2:zone 3
test:zone 1:zone 2:zone 3

So the result with the join should be

test100:zone 1 :zone 2:zone 3:zone 4 :zone 5
test100:zone11:zone22:zone33:zone 4 :zone 5
test10:zone 1:zone 2:zone 3:zone 4 :zone 5
test:zone 1:zone 2:zone 3:zone 4 :zone 5

but it is with your command

test100:zone 1 :zone 2:zone 3 4:zone 5
test100:zone11:zone22:zone33 4:zone 5
test10:zone 1:zone 2:zone 3 4: zone

      Thierry

The files must be correctly sorted into ASCII order...

$ sort -t: -k1,1 file1.txt > file1.sorted
$ sort -t: -k1,1 file2.txt > file2.sorted
$ join -t: file1.sorted file2.sorted
test:zone 1:zone 2:zone 3 :zone 4: zone 5
test10:zone 1:zone 2:zone 3 :zone 4:zone 5
test100:zone 1 :zone 2:zone 3 :zone 4:zone 5

Cheers
ZB

Hi zazzybob

Thanks a lot, it works. In fact I had a sort in the script, but it was not the good one (sort -A).

I dont' know what time it is in Australia, but have good day

Thierry