我有2个标签分隔的文件。
fileA. tsv
probeId sample1_betaval sample2_betaval sample3_betaval
a 1 2 3
b 4 5 6
c 7 8 9
fileB.tsv
probeId region gene
a intronic tp53
b non-coding NA
c exonic kras
由于它们已经按probeId排序,我把两个文件合并了。
join -j 1 fileA.tsv fileB.tsv -t $'\t' > complete.tsv
问题是输出的文件没有保存头部。
a 1 2 3 intronic tp53
b 4 5 6 non-coding NA
c 7 8 9 exonic kras
而我想要的输出是:
probeId sample1_betaval sample2_betaval sample3_betaval region gene
a 1 2 3 intronic tp53
b 4 5 6 non-coding NA
c 7 8 9 exonic kras
我怎么才能做到呢?
解决方案:
添加 --header
选项,如果您的加入提供了它。
join --header -j 1 fileA.tsv fileB.tsv -t $'\t' > complete.tsv