Cross checking two files

i have two files which contains some fields separated by columns as

03/29/1999           08:48:12            02          172.16.114.50
03/29/1999           09:08:00          480          172.16.112.100

Both of the files do have the same format
I want the script which will take two such files as input and give the output as the count of number of lines that exactly matched in both the files
How to deal with this?

thanks in advance

grep -cf f1 f2
awk 'NR==FNR{a[$0]; next}$0 in a{++c}END{print c}' file1 file2

Hi,

Are you trying to match the content of file also?

Otherwise below code will work

#!/bin/bash
file1count=`cat file1 | wc -l`
file2count=`cat file2 | wc -l`
echo File1 $file1count
echo File2 $file2count

you can modify this code if you want to pass file name as argument.

Thanks,
Yagami