How to make grep command return entire matching line
If I am not mistaken, grep
shows the whole line for which a match has been found.
For a specific word, I use grep
directly instead of cat | grep
.
grep -w "foobar" /var/log/messages.log
If you do not see any other output, it would mean that there isn't anything else on that line.