Is there a way to `fgrep` with the "and" of all the passed in patterns instead of the "or"?

Viewed 48

I want to do a search in a log file like this:

/logs/loggy.log:

INFO:  cats are people
DEBUG: one doth fig're and therefore one doth be
INFO:  cookies made via the catapultation of figs at an acceleration of 1 m/s^2.
INFO:  informative information about my information systems

I want just the 3rd line. So I command:

grep 'cat.*fig' /logs/loggy.log

But it's a large file! Let's make it faster

grep -F -e cat -e fig /logs/loggy.log

0ops. Now I'm getting back all the lines because it now matches for either 'cat' or 'fig'. I want it to match only lines containing bolth. Is there a way to do this without going back into regular expressions land?

1 Answers
Related