Another approach is doing "external grep"; from the manual (:help :grep):
5.2 External grep
Vim can interface with "grep" and grep-like programs (such as the GNU
id-utils) in a similar way to its compiler integration (see |:make| above).
*:gr* *:grep*
:gr[ep][!] [arguments] Just like ":make", but use 'grepprg' instead of
'makeprg' and 'grepformat' instead of 'errorformat'.
When 'grepprg' is "internal" this works like
|:vimgrep|. Note that the pattern needs to be
enclosed in separator characters then.
If the encoding of the program output differs from the
'encoding' option, you can use the 'makeencoding'
option to specify the encoding.
*:lgr* *:lgrep*
:lgr[ep][!] [arguments] Same as ":grep", except the location list for the
current window is used instead of the quickfix list.
For me, grepprg is set to the default (see with :set grepprg) that uses the external grep, and so I could do
:grep -v 'my_pattern' %
where % refers to the current file's name (see :help :_%).
After this, one can use :copen or :lopen to look up the results in the quickfix or location lists (depending whether :grep or :lgrep has been used, respectively).
NOTE
The external grep will always work on the saved file, and not on the buffer. Keep that in mind when getting inconsistent results.