Compare the content of 2 files

Hi Guys,

What is the most effecient way to compare the content of 2 seperate files and extract the result of there is a match? We have 2 separate log files and we are trying to find the common errors from the 2 files.

Thanks,

Odogbolu98
:frowning:

You can try the comm command (read the man page for the switch you need) but it isn't going to do much good if these log files entries are time stamped. You would need to read in each file and do a line by line compare after stripping the date/time.

Check out `diff`. It should have this ability.

Would it not be better to use perl to read both log files?

You could parse the data and read it into a data structure and
compare the data in liner loops.

Perl would be able to compare both log files in almost any way
conceivable.