bash grep 没有找到基因的所有实例

bash grep 没有找到基因的所有实例

我有一个包含基因名称的 file1:

Appl
Bsg
mt:CoI
mt:CoII
mt:CoIII

我有 file2,其中包含基因组中所有与这些基因名称匹配的内容:

"FBgn0000108"; "Appl";
"FBgn0000228"; "Bsg25D";
"FBgn0013674"; "mt:CoI";
"FBgn0013674"; "mt:CoI";
"FBgn0013675"; "mt:CoII";
"FBgn0013676"; "mt:CoIII";
"FBgn0261822"; "Bsg";
"FBgn0000227"; "Bsg25A";

我希望输出包含 file1 中含有参考 ID 的行:

"FBgn0000108"; "Appl";
"FBgn0013674"; "mt:CoI";
"FBgn0013674"; "mt:CoI";
"FBgn0013675"; "mt:CoII";
"FBgn0013676"; "mt:CoIII";
"FBgn0261822"; "Bsg";

我已经尝试过了

fgrep -wf file1 file2 > file3

但这会消除 mt:CoII 和 mt:CoIII,因为它们包含 mt:CoI:

"FBgn0000108"; "Appl";
"FBgn0013674"; "mt:CoI";
"FBgn0261822"; "Bsg";

我真的很感激一些关于如何修改 grep 命令以获得所需输出的帮助!

相关内容