在下面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
输入/ home / cmccabe / oncomine / report / final 123_Last-First_oca.txt
Controls:
4 expression controls detected
AWK 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 '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