Why do I have "join: extra operand '/dev/fd/62'" error?
2
votes
1
answer
1128
views
I have a script
equijoin2
:
#! /bin/bash
# default args
delim="," # CSV by default
outer=""
outerfile=""
# Parse flagged arguments:
while getopts "o:td:" flag
do
case $flag in
d) delim=$OPTARG;;
t) delim="\t";;
o) outer="-a $OPTARG";;
?) exit;;
esac
done
# Delete the flagged arguments:
shift $(($OPTIND -1))
# two input files
f1="$1"
f2="$2"
# cols from the input files
col1="$3"
col2="$4"
join "$outer" -t "$delim" -1 "$col1" -2 "$col2" <(sort "$f1") <(sort "$f2")
and two files
$ cat file1
c c1
b b1
$ cat file2
a a2
c c2
b b2
Why does the last command fail? Thanks.
$ equijoin2 -o 2 -d " " file1 file2 1 1
a a2
b b1 b2
c c1 c2
$ equijoin2 -o 1 -d " " file1 file2 1 1
b b1 b2
c c1 c2
$ equijoin2 -d " " file1 file2 1 1
join: extra operand '/dev/fd/62'
Asked by Tim
(106430 rep)
Jul 24, 2018, 05:40 AM
Last activity: Aug 31, 2024, 05:07 AM
Last activity: Aug 31, 2024, 05:07 AM