help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: EB double-grep function for bash


From: Emanuel Berg
Subject: Re: EB double-grep function for bash
Date: Thu, 21 Jul 2016 18:21:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Tomas Nordin wrote:

> Since the thread strayed away a little from
> emacs already...

Only superficially. The problem is how to find
a particular Emacs tool. The assumption is that
the user knows the conventional designation of
the tool and that the same designation is used
in Emacs. The answer what to do is as usual not
a single answer but a toolbox of methods in
itself, one of the tools proposed being greping
the Emacs source.

To do that we use the conventional shell tools
like grep, but one could easily think of
several others, e.g., awk, sed, even Perl.
To those who didn't know, grep is not only an
acronym-contraction, it was once a *command* in
one of the early line editors, for "global
regular expression print" - which makes sense!

I think I read this in either:

    @book{quarter-century-of-unix,
      title      = {A Quarter Century of UNIX},
      author     = {Peter Salus},
      publisher  = {Addison-Wesley},
      year       = 1994,
      ISBN       = 0201547775,
    }

or

    @book{sed-awk,
        title     = {sed \& awk},
        author    = {Dale Dougherty; Arnold Robbins},
        publisher = {O'Reilly},
        year      = 1997,
        edition   = {2nd edition},
        ISBN      = {1-56592-225-5},
    }

In Emacs, there is `grep', `grep-find', and so
on in

    /usr/share/emacs/24.4/lisp/progmodes/grep.el

    (or: /usr/share/emacs/24.4/lisp/progmodes/grep.el.gz)

That code is - advanced :)

> I made a little change on two
> lines in this function to make it run with
> bash. (I think the array subscript is a zsh
> thing). Here's the lines:
>
>         local files
>         files=${@:5:$#}

Cool :)

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 58 Blogomatic articles -                   


reply via email to

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