Re: bug in join

Jim Meyering <[email protected]> Wed, 26 Feb 2003 15:13:37 +0100
Newsgroups gmane.comp.gnu.textutils.bugs
Message-ID <[email protected]>
"Haidong Wang" <[email protected]> wrote:
> With following two simple files:
>
> test1:
> a	f
> b	h
> c	g
>
> test2:
> 1	b
> 2	g
> c	6
>
> join -j 2 test1 test2
>
> gives the wrong result which is nothing.
>
> The correct result should be:
> G	c	2

Thank you for the report, but that is not a bug.
The input files must be sorted on the respective fields
used to perform the join operation, and neither of those
files is properly sorted.

Since I see you've used a TAB to separate the fields,
you should sort each of those files using `sort -k2,2b'.
Then your command would produce this output:

g c 2