I have two files large files:
1) file1.txt as below: ( more than 20,000 records )
5020120475 |13ZJ38000813 |20141204|R
5020127431 |13ZJ38001569 |20141201|R
5020127689 |12ZJ44000606 |20141203|R
5020127728 |13ZJ38001356 |20141203|R
5020127956 |13ZJ62002544 |20141205|R
5020127972 |13ZJ49000082 |20141205|R
5020128325 |13ZJ57000785 |20141210|R
5020128706 |13ZJ38002805 |20141211|R
5020129084 |10XJ70107764 |20141217|R
5020129102 |12ZJ54000041 |20141217|R
and
2) other file as file2.txt as below: ( more than 2,00,000 records )
09Y903010552
12ZJ54000041
11XJ62118385
08Y909018946
09Y902011954
11XJ57120346
10XJ70107764
11XJ40165329
09XJ42008336
08Y912021435
11XJ51040272
07Y910027235
and I need expexted output as below:
5020129084 |10XJ70107764 |20141217|R
5020129102 |12ZJ54000041 |20141217|R
NOTE: it will compare first file of 2nd column and second file of ist column and print the compare records of ist file as above.
Many thanks for help in Perl or unix awk.