Bash join command

后端 未结 3 1423
长发绾君心
长发绾君心 2020-12-16 19:13

Infile1:

1 a
3 c
4 d
6 f

Infile2:

1 a 
2 b
5 e
6 f
7 g
8 h

How do I join these files with the unix join c

3条回答
  •  感情败类
    2020-12-16 19:52

    Works for me (almost). You should specify -t $'\t' for the tab character, not just -t \t. Bash does not interpret \t unless in $'' quotes.

    join -t $'\t' -o 1.2,2.2 <(echo  $'27\t27
    28\t22
    29\t37
    30\t15
    31\t21
    32\t13
    33\t18
    34\t24' | sort) <(echo $'27\t7
    28\t13
    29\t6
    30\t12
    31\t30
    32\t5
    33\t10
    34\t28' | sort)
    27      7
    22      13
    37      6
    15      12
    21      30
    13      5
    18      10
    24      28
    

提交回复
热议问题