1

我有两张桌子。表 1 样本有多个列,表 2 有一个列。我的问题是,如何根据表 1 中的值从表 1 中提取行。我想一个简单的 grep 应该可以工作,但我怎样才能对每一行进行 grep。谢谢!

表格1:

IPI00436567;    Q6VEP3;
IPI00169105;IPI01010102;    Q8NH21;
IPI00465263;    Q6IEY1;
IPI00465263;    Q6IEY1;
IPI00478224;    A6NHI5;
IPI00853584;IPI00000733;IPI00166122;    Q96NU1-1;Q96NU1-2;
IPI00411886;IPI00921079;IPI00385785;    Q9Y3T9;
IPI01010975;IPI00418437;IPI01013997;IPI00329191;    Q6TDP4;
IPI00644132;IPI00844469;IPI00030240;    Q494U1-1;Q494U1-2;
IPI00420049;IPI00856062;    Q5SV97-1;Q5SV97-2;
IPI00966381;IPI00917954;IPI00028151;    Q9HCC6;
IPI00375631;    P05161;
IPI00374563;IPI00514026;IPI00976820;    O00468;
IPI00908418;    E7ERA6;
IPI00062955;IPI00002821;IPI00909677;    Q96HA4-1;Q96HA4-2;
IPI00641937;IPI00790556;IPI00889194;    Q6ZVT0-1;Q6ZVT0-2;Q6ZVT0-3;
IPI00001796;IPI00375404;IPI00217555;    Q9Y5U5-1;Q9Y5U5-2;Q9Y5U5-3;
IPI00515079;IPI00018859;    P43489;
IPI00514755;IPI00004233;IPI00106646;    Q9BRK5-1;Q9BRK5-2;
IPI00064848;    Q96L58;
IPI00373976;    Q5T7M4;
IPI00375728;IPI86;IPI00383350;  Q8N2K1-1;Q8N2K1-2;
IPI01022053;IPI00514605;IPI00514599;    P51172-1;P51172-2;

表 2:

IPI00000207
IPI00000728
IPI00000733
IPI00000846
IPI00000893
IPI00001849
IPI00002214
IPI00002335
IPI00002349
IPI00002821
IPI00003362
IPI00003419
IPI00003865
IPI00004233
IPI00004399
IPI00004795
IPI00004977
4

1 回答 1

2

您可以使用将-f文件作为参数的选项

grep -f table2 table1
于 2013-09-16T21:29:58.077 回答