我已经开始使用 linux 机器,我正在尝试做一些简单的事情……但对我来说很难。我需要选择一些与第二个文件中报告的行相匹配的特定行。实际上,我有一个像这样制作的第一个文件:
>aba19 EN1 enl.or11 http://mar2043 annotation not avaliable
MASESEMGVVASJDHAGISFGVDDASDASDAFGDFGHWFACFQLIGIFLAYCLSRAITNN
QSDHKAJSDHKASJHKJAHKHKJSDGHYEIV
>clat38 EN2 enl.o http://mar20s/Gene/Summary?5 annotation not avaliable
MNCEDCHILNAEAFKSKKDASDADICKSLKICGLVFGILALTLIVLFWGSKHFWPEVPKK
AYDMEHTFYSNGERGYCCASDSDDIYCSDRRGNRYCRRVCEPLLGYYPYPYCYQGGRVIC
RVIMPCDASDASDAOPWEIPQWFHNDJBVHAOISDOUIAODGNWWVARMLGRV
>coll9 EN4 ens4 http://mar2010.arch/Genary?g=E9 annotation not avaliable
MASKALDHLFKLJLÒFJASDJKLASDLAFJLFJFJLFJLAJFLKJFLAKFJFJLAFJLAL
ASDLASKDJASLKDJASLKJFALSKDJALKDJSKLDJLSDKJASLDKJSLDKSDLAKJKS
SILDUAISDALSDJALKDJASDLFATT
>hihi9 EN9 ens44 http://mar2010.ariens/Geary?g=EN7 annotation not avaliable
MGSLDLAÈPWOEMWBZMKSJDHAJKSDHAKSDHSDHSDHOASDAKSJDHKASJDHAAKHL
KTLSDKLHRFSDFHPHFGCJLJLJRKKFLDSFCGTVGEFAGGGDTHNNVCLSSVFVSEDG
HSDFSDWFKLGGMETVCSDFKVSQATPEFSSSDLFFDSRIQSIRDPASIPPEEMSPEFTT
LPECHGHARDAFSFGTLVESLLTILNEQVSADVLSSFQQTLHSTLLNPIPKCRPALCTLL
SDFLSDJFKLSDFLSKDFJM
我有第二个文件,其中包含我需要从第一个文件中“提取”的模式列表。第二个文件如下所示:
>clat38
>coll9
实际上,我希望有这样的输出:
>clat38 EN2 enl.o http://mar20s/Gene/Summary?5 annotation not avaliable
MNCEDCHILNAEAFKSKKDASDADICKSLKICGLVFGILALTLIVLFWGSKHFWPEVPKK
AYDMEHTFYSNGERGYCCASDSDDIYCSDRRGNRYCRRVCEPLLGYYPYPYCYQGGRVIC
RVIMPCDASDASDAOPWEIPQWFHNDJBVHAOISDOUIAODGNWWVARMLGRV
>coll9 EN4 ens4 http://mar2010.arch/Genary?g=E9 annotation not avaliable
MASKALDHLFKLJLÒFJASDJKLASDLAFJLFJFJLFJLAJFLKJFLAKFJFJLAFJLAL
ASDLASKDJASLKDJASLKJFALSKDJALKDJSKLDJLSDKJASLDKJSLDKSDLAKJKS
SILDUAISDALSDJALKDJASDLFATT
我试过grep -f file_2 file_1 > output
但我只得到这个:
>clat38
>coll9
我可以添加一些更具体到 grep 的内容吗?感谢您的任何建议!瞎扯