How to make grep only match if the entire line matches?

Solution 1:

grep -Fx ABB.log a.tmp

From the grep man page:

-F, --fixed-strings
Interpret PATTERN as a (list of) fixed strings
-x, --line-regexp
Select only those matches that exactly match the whole line.

Solution 2:

Simply specify the regexp anchors.

grep '^ABB\.log$' a.tmp