Thank you for the reply! I will give this a shot!
This has been a big help!!
Russ


-----Original Message-----
From: Marius Gedminas <mar...@gedmin.as>
To: vim_use@googlegroups.com <vim_use@googlegroups.com>
Sent: Thu, Sep 3, 2020 2:07 am
Subject: Re: Using vimgrep to find files NOT containing a string

On Wed, Sep 02, 2020 at 07:14:37PM +0000, russurquhart1 via vim_use wrote:
> I generally use:
> 
> :vim `beta: ` **/*.md | copen
> 
> To traverse my Markdown files to find those containing 'beta: '.
> 
> I need to do the opposite but can get the pattern right. I tried
> 
> :vim -v `beta: ` **/*.md | copen
> 
> thinking that might work but no dice.
> 
> I looked through teh vimgrep help but couldn't find anything.
> 
> Does anyone know how to do this?

Not with vimgrep, but on the command line to find files that don't
contain a pattern I generally do

  grep -c "beta: " **/*.md | grep ':0$' | sed -e 's/:0$//'

this assumes your shell can do ** and it's probably not the most
elegant/efficient way of doing it, but it's one that I can remember how
to spell.

And then I opened the grep manual page to see if there's an easier way,
and lo and behold:

      -L, --files-without-match
              Suppress normal output; instead print the name of each
              input file from which no output would normally have  been
              printed.  The scanning will stop on the first match.

Just what the doctor ordered!

To feed these files to to vim you could play with temporarily setting
'grepprg', or use :args `grep -L "beta: " **/*.md`

If your shell doesn't do **, you may need to use something a bit more
complicated like

  find -name '*.md' -exec grep -L "beta: " {} +

HTH,
Marius Gedminas
-- 
Si hoc legere scis nimium eruditionis habes.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/20200903070704.trx46k7456rjuhhj%40blynas.

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/1299755177.202881.1599138996832%40mail.yahoo.com.

Reply via email to