I have two files large files:
f1.txt:
5020118359 |13ZJ24001218 |20141224|R
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
f2.txt:
09Y903010552
12ZJ54000041
11XJ62118385
08Y909018946
09Y902011954
11XJ57120346
10XJ70107764
11XJ40165329
09XJ42008336
08Y912021435
11XJ51040272
07Y910027235
Output:
5020129084 |10XJ70107764 |20141217|R
5020129102 |12ZJ54000041 |20141217|R
it will compare 2nd column of the first file and 1st column of the second file and then print the matched records of the 1st file.