emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ find-grep-dired ] Regexp input and other remarks


From: Richard Stallman
Subject: Re: [ find-grep-dired ] Regexp input and other remarks
Date: Sun, 3 Mar 2002 07:39:56 -0700 (MST)

Does this version work better?

(defun find-grep-dired (dir regexp)
  "Find files in DIR containing a regexp REGEXP and start Dired on output.
The command run (after changing into DIR) is

    find . -exec grep -s -e REGEXP {} \\\; -ls

Thus ARG can also contain additional grep options."
  (interactive "DFind-grep (directory): \nsFind-grep (grep regexp): ")
  ;; find -exec doesn't allow shell i/o redirections in the command,
  ;; or we could use `grep -l >/dev/null'
  ;; We use -type f, not ! -type d, to avoid getting screwed
  ;; by FIFOs and devices.  I'm not sure what's best to do
  ;; about symlinks, so as far as I know this is not wrong.
  (find-dired dir
              (concat "-type f -exec grep " find-grep-options " -e "
                      (shell-quote-argument regexp)
                      " {} \\\; ")))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]