2

Windows 10, Emacs 26.1

M-x shell
grep

here result:

grep
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.

Nice. Now I want to find files in temp folder:

  • rgrep
  • Search for - empty
  • Wild card - empty
  • Base directory - select current dir

And here result:

-*- mode: grep; default-directory: "d:/TEMP/temp/" -*-
Grep started at Tue Nov 27 18:55:02

find . -type d "(" -path "*/SCCS" -o -path "*/RCS" -o -path "*/CVS" -o -path "*/MCVS" -o -path "*/.src" -o -path "*/.svn" -o -path "*/.git" -o -path "*/.hg" -o -path "*/.bzr" -o -path "*/_MTN" -o -path "*/_darcs" -o -path "*/{arch}" ")" -prune -o ^"^!^" -type d "(" -name ".#*" -o -name "*.o" -o -name "*~" -o -name "*.bin" -o -name "*.bak" -o -name "*.obj" -o -name "*.map" -o -name "*.ico" -o -name "*.pif" -o -name "*.lnk" -o -name "*.a" -o -name "*.ln" -o -name "*.blg" -o -name "*.bbl" -o -name "*.dll" -o -name "*.drv" -o -name "*.vxd" -o -name "*.386" -o -name "*.elc" -o -name "*.lof" -o -name "*.glo" -o -name "*.idx" -o -name "*.lot" -o -name "*.fmt" -o -name "*.tfm" -o -name "*.class" -o -name "*.fas" -o -name "*.lib" -o -name "*.mem" -o -name "*.x86f" -o -name "*.sparcf" -o -name "*.dfsl" -o -name "*.pfsl" -o -name "*.d64fsl" -o -name "*.p64fsl" -o -name "*.lx64fsl" -o -name "*.lx32fsl" -o -name "*.dx64fsl" -o -name "*.dx32fsl" -o -name "*.fx64fsl" -o -name "*.fx32fsl" -o -name "*.sx64fsl" -o -name "*.sx32fsl" -o -name "*.wx64fsl" -o -name "*.wx32fsl" -o -name "*.fasl" -o -name "*.ufsl" -o -name "*.fsl" -o -name "*.dxl" -o -name "*.lo" -o -name "*.la" -o -name "*.gmo" -o -name "*.mo" -o -name "*.toc" -o -name "*.aux" -o -name "*.cp" -o -name "*.fn" -o -name "*.ky" -o -name "*.pg" -o -name "*.tp" -o -name "*.vr" -o -name "*.cps" -o -name "*.fns" -o -name "*.kys" -o -name "*.pgs" -o -name "*.tps" -o -name "*.vrs" -o -name "*.pyc" -o -name "*.pyo" ")" -prune -o  -type f "(" -iname "*" -o -iname ^".[^!.]*^" -o -iname "..?*" ")" -exec grep --color=always -i -nH --null "how_test" "{}" ";"
FIND: Parameter format not correct

Grep exited abnormally with code 2 at Tue Nov 27 18:55:03

Why I get error:

Grep exited abnormally with code 2 at Tue Nov 27 18:55:03
a_subscriber
  • 3,854
  • 1
  • 17
  • 47

1 Answers1

1

Looks like you are accidentally using the MS Windows find command.

You need to have a UNIX or GNU/Linux find command (and grep command). You can use Cygwin, for example. Or if you have such a command available already then you need to put such programs in your PATH environment variable.

See this Emacs Wiki category page for links to wiki pages about using Emacs on MS Windows. See this wiki page about Cygwin.


Besides that, be aware that Emacs offers various Emacs grep commands. So once you have available a working grep program you can use M-x grep instead of bothering explicitly with a shell. This has various advantages. See the Emacs manual, node Grep Searching for more info.

Drew
  • 75,699
  • 9
  • 109
  • 225