Imagine you have a CLI command cat myfile | ./my-filter
, and now you want to see all the lines not selected, essentially negating my-filter
. Here is a way to achieve that.
The "grep for complements" command is a useful tool for filtering out lines from a file that have not been selected by a custom filter. This can be achieved using a combination of cat
, your custom filter (./my-filter
), and grep
.
To use "grep for complements", follow these steps: