我有两个文件。
A0001 C001
B0003 C896
A0024 C234
.
B1542 C231
.
upto 28412 such lines
Run Code Online (Sandbox Code Playgroud)
A0001
A0024
B1542
.
.
and 12000 such lines.
Run Code Online (Sandbox Code Playgroud)
我想将文件 2 与文件 1 进行比较并存储文件 1 中的匹配行。我尝试过 Perl 和 Bash,但似乎都没有工作。
我最近尝试的事情是这样的:
for (@q) # after storing contents of second file in an array
{
$line =`cat File1 | grep $_`; #directly calling File 1 from bash
print $line;
}
Run Code Online (Sandbox Code Playgroud)
但它失败了。