Hi,
I try to use grep to match a case like this:
I have a list of hostname and ips in this format:
238-456 192.168.1.1
ak238-456 192.168.1.2
238-456a 192.168.1.3
458-862 192.168.1.4
Now i try to grep "238-456" but of course this returns:
238-456 192.168.1.1
and...
ak238-456 192.168.1.2
and...
238-456a 192.168.1.1
but i only need the line with exactly 238-456. In this case i can't use -x because then of course it returns no results.
Is there a simply way to solve this?
The given answers with "^" solve the first problem. But not the one with the "a" at the end. Can somenone also help with this?