I can't seem to recursively search with grep for some reason in WSL2.
me@SOMEHOST:~$ grep -r -e "DATASTORE_BAKs" --exclude=SOMEHOST-2\.viminfo *
grep: SOMEHOST-2.viminfo: invalid context length argument
It seems to have something to do with my .viminfo
file, but I can't exclude it properly and I can't even ignore the file using the ignore binary arg.
The file seems to contain alot of --
characters and I'm wondering if that's screwing it up.
I also did a file
command on it and it doesn't warrant much:
le ./.viminfo
./.viminfo: data
How can I make this work again?
grep -r -e "DATASTORE_BAKs" --exclude=SOMEHOST-2\.viminfo -- *
? It's more likely that you have a file named something like-ASOMEHOST-2\.viminfo
or-CSOMEHOST-2\.viminfo
in the current directory – steeldriver Dec 28 '22 at 00:55.
instead of*
? – muru Dec 28 '22 at 03:38.viminfo
(the exclusion pattern is only ever tested against the filenames themselves, not against the full pathname). 2) The error is likely due to a file with a name starting with a dash. This name is likely in the current directory and will be substituted on the command line by the expansion of the*
glob. Use-- *
as steeldriver suggests. This has nothing to do with the.viminfo
file. This is not an answer, as I don't know what your filenames are in the current directory. – Kusalananda Dec 28 '22 at 11:45-- *
worked. What does that do again? – leeand00 Dec 28 '22 at 16:23-
. See for example What does "--" (double-dash) mean? – steeldriver Dec 28 '22 at 16:50.
instead of*
(unless your intent is to skip hidden files/directories in the current directory?) – steeldriver Dec 28 '22 at 17:56