I have two files.
File 1:
A0001 C001
B0003 C896
A0024 C234
.
B1542 C231
.
upto 28412 such lines
File 2:
A0001
A0024
B1542
.
.
and 12000 such lines.
I want to compare File 2 against File 1 and store the matching lines from File 1. I tried Perl and Bash but none seems to be working.
The latest thing I tried was something like this:
for (@q) # after storing contents of second file in an array
{
$line =`cat File1 | grep $_`; #directly calling File 1 from bash
print $line;
}
but it fails.