all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: EB double-grep function for bash
Date: Thu, 21 Jul 2016 18:21:44 +0200	[thread overview]
Message-ID: <86oa5r3qsn.fsf@student.uu.se> (raw)
In-Reply-To: mailman.1702.1468961014.26859.help-gnu-emacs@gnu.org

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	other threads:[~2016-07-21 16:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1702.1468961014.26859.help-gnu-emacs@gnu.org>
2016-07-21 16:21 ` Emanuel Berg [this message]
2016-07-16  7:07 require basic stuff from specific packages Emanuel Berg
2016-07-19 20:43 ` EB double-grep function for bash Tomas Nordin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86oa5r3qsn.fsf@student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.