[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep excludes
From: |
B.V. Raghav |
Subject: |
Re: grep excludes |
Date: |
Thu, 07 Jul 2016 11:45:40 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
bvraghav@iitk.ac.in (B.V. Raghav) writes:
> (defun my-grep(pattern file-name)
> "My own version of grep command"
> (interactive "sPattern: \nFFind %s in file(s): ")
> (let ((cmd "grep -e"))
> ;; ^^^^^^^^^ My Grep Command
> (grep (message "%s %s %s" cmd pattern file-name))))
>
> If I understand correctly, you requires the change of command as
> mentioned here.
>
> HTH
On second thoughts, the following set should be helpful:
(defun my-grep-base(grep-cmd params)
(grep (format "%s %s %s" grep-cmd (car params) (cadr params))))
(defun my-grep-params(pattern file-name)
"My own version of grep command"
(interactive "sPattern: \nFFind %s in file(s): ")
(list pattern file-name))
(defun my-grep()
(interactive)
(my-grep-base "grep -e" (call-interactively #'my-grep-params)))
(defun my-lgrep()
(interactive)
(my-grep-base "lgrep -e" (call-interactively #'my-grep-params)))
(defun my-rgrep()
(interactive)
(my-grep-base "rgrep -e" (call-interactively #'my-grep-params)))
and you can define lgrep and rgrep in your .bashrc (or .bash_aliases) as
follows:
alias lgrep='grep -n '
alias rgrep='grep -nR '
HTH
--
(B.V. Raghav)
Ph.D. Student,
Design Programme, IIT Kanpur
- Re: grep excludes, Emanuel Berg, 2016/07/05
- Re: grep excludes, Rusi, 2016/07/05
- Re: grep excludes, Emanuel Berg, 2016/07/06
- Re: grep excludes, B.V. Raghav, 2016/07/06
- Re: grep excludes,
B.V. Raghav <=
- Message not available
- Re: grep excludes, Rusi, 2016/07/07
- Re: grep excludes, Rusi, 2016/07/07
- Re: grep excludes, Rusi, 2016/07/07
- Re: grep excludes, B.V. Raghav, 2016/07/09