💾 Archived View for gemini.ctrl-c.club › ~fte368 › 2023 › 2023-03-26_grep.gmi captured on 2023-04-20 at 00:11:45. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Listing non-matching files

I use the grep command on Unix for a long time already. Nevertheless I found out that I missed something it can do.

Maybe I never looked hard enough, maybe I never really needed this: Looking for files which do not contain a certain string.

Listing all files which contain a given string is easy. For example looking for all files in the current directory containing the word "computer" would be:

grep -li computer *

The -v switch does not help when looking for files not containg a string. Instead the -L switch has to be used:

grep -iL computer *