I have two files file1 and and file2. file1 has 63000 lines and file2 has 6000 lines. I need to print the lines which are in both files.
file1
1bl9
1bln_2
1bln_3
1blx
1blx
1bm3
1bm3
1bm9_1
1bm9_2
1bm9_1
1bm9_2
file2
1blx
1blx
1bm4
1bln_2
output
1blx
1blx
1bln_2
I used the following program . But it works for files having less number of lines. It doesn't work for files having large number of lines.
awk 'FNR==NR { a[$0]; next } $0 in a' file2 file1