Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to join 3 files on a column which has sorted unique numeric values (those files have only one column of values though) and starts with same prefix for an example "usi".

Now, while I am doing this

join -j 1 ../Test_Data/usi* > ../Test_Data/join_output.txt

I am finding following error:

join: extra operand `usi_rtree_lw_100000.txt'
Try `join --help' for more information.

Any ideas?

share|improve this question

join accepts only 2 files to join. To operate on 3 file you have to use 2 join calls:

join -j 1 <(join -j 1 ../Test_Data/usi-1 ../Test_Data/usi-2) ../Test_Data/usi-3 > ../Test_Data/join_output.txt

The above command requires bash, as uses process substitution. If you use another shell, please specify which.

Update according to the comment.
If you know only a file name pattern instead of exact file names, let the shell expand the pattern, capture the expanded list in an array then use the array elements as parameters:

join -j 1 <(join -j 1 "${file[0]}" "${file[1]}") "${file[2]}"
share|improve this answer
actually the problem is , I know only the prefixes of the files,I cant use the exact names of them. – MiNdFrEaK Oct 22 '12 at 7:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.