bash移动选择字段以匹配两个目录中的文件前缀

时间:2018-01-12 20:19:40

标签: bash

在下面bash我尝试使用123_Last-First的前缀file1来匹配123_Last-First中的前缀file2。始终会找到匹配项(即如果有file1则必须有file2)。在file2$5&6$7(始终以制表符分隔)的内容

$5 = Total_Targets with value under it that can be a decimal or integer

$6 = Targets_less_than250x with value under it that can be a decimal or integer

$7 = Percent_more_than250x with value under it that can be a decimal or integer

会在标题Quality metrics下复制到它。下面执行但没有产生输出。我添加了评论来帮助和展示我的想法。谢谢你:)。

/ home / cmccabe / oncomine / 250x中的file1

123_Last-First_250x.txt
Position    Gene    Type    Reads   Total_Targets   Targets_less_than250x   Percent_more_than250x
chr4:55141051   PDGFRA  NOCALL  13  2353    1   99.9575
/ home / cmccabe / oncomine / report

中的文件2

123_Last-First_oca.txt
Controls:
4 expression controls detected
输入/ home / cmccabe / oncomine / report / final

123_Last-First_oncomine.txt
Quality metrics:
Total_Targets   Targets_less_than250x   Percent_more_than250x
2353    1   99.9575
Controls:
4 expression controls detected

AWK

awk 'FNR==NR{A[$5,$6,$7]=$0;next}$1 in A' OFS=\'t'  123_Last-First_250x.txt 123_Last-First_oca.txt | awk 'NR>1{print "Quality metrics:"}' > /home/cmccabe/oncomine/report/final/123_Last-First_oncomine.txt

0 个答案:

没有答案