Unix Command to compare the two files with 4 common filelds and write those records in another file

How to compare two files with 4 common fields and write those records in another file in unix.