How to make grep only match if the entire line matches?
grep, shell, unix
Solution
Simply specify the regexp anchors.
grep '^ABB\.log$' a.tmp
Problem
I have these: ``` $ cat a.tmp ABB.log ABB.log.122 ABB.log.123 ``` I wanted to find a exact match of ABB.log. But when I did ``` $ grep -w ABB.log a.tmp ABB.log ABB.log.122 ABB.log.123 ``` it shows all of them. Can I get what I wanted using grep?