Join problem: throwing error, join extra operand

Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
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?
text-processing join
add a comment |
up vote
2
down vote
favorite
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?
text-processing join
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
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?
text-processing join
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?
text-processing join
text-processing join
edited Nov 18 at 21:12
don_crissti
48.7k15129157
48.7k15129157
asked Oct 22 '12 at 3:45
MiNdFrEaK
69451423
69451423
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
3
down vote
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:
file=(../Test_Data/usi*)
join -j 1 <(join -j 1 "$file[0]" "$file[1]") "$file[2]"
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
add a comment |
up vote
0
down vote
POSIX shell variants of manatwork's answer:
printf '"%s" ' ../Test_Data/usi* | read a b c ; join $a $bset -- ../Test_Data/usi* ; join "$1" "$2" | join - "$3"
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
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:
file=(../Test_Data/usi*)
join -j 1 <(join -j 1 "$file[0]" "$file[1]") "$file[2]"
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
add a comment |
up vote
3
down vote
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:
file=(../Test_Data/usi*)
join -j 1 <(join -j 1 "$file[0]" "$file[1]") "$file[2]"
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
add a comment |
up vote
3
down vote
up vote
3
down vote
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:
file=(../Test_Data/usi*)
join -j 1 <(join -j 1 "$file[0]" "$file[1]") "$file[2]"
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:
file=(../Test_Data/usi*)
join -j 1 <(join -j 1 "$file[0]" "$file[1]") "$file[2]"
edited Oct 22 '12 at 8:02
answered Oct 22 '12 at 6:30
manatwork
21.4k38284
21.4k38284
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
add a comment |
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
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
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
add a comment |
up vote
0
down vote
POSIX shell variants of manatwork's answer:
printf '"%s" ' ../Test_Data/usi* | read a b c ; join $a $bset -- ../Test_Data/usi* ; join "$1" "$2" | join - "$3"
add a comment |
up vote
0
down vote
POSIX shell variants of manatwork's answer:
printf '"%s" ' ../Test_Data/usi* | read a b c ; join $a $bset -- ../Test_Data/usi* ; join "$1" "$2" | join - "$3"
add a comment |
up vote
0
down vote
up vote
0
down vote
POSIX shell variants of manatwork's answer:
printf '"%s" ' ../Test_Data/usi* | read a b c ; join $a $bset -- ../Test_Data/usi* ; join "$1" "$2" | join - "$3"
POSIX shell variants of manatwork's answer:
printf '"%s" ' ../Test_Data/usi* | read a b c ; join $a $bset -- ../Test_Data/usi* ; join "$1" "$2" | join - "$3"
answered Nov 18 at 21:00
agc
4,43311035
4,43311035
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f52528%2fjoin-problem-throwing-error-join-extra-operand%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown