git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jakub Narebski <jnareb@gmail.com>
Subject: Re: [PATCH/RFC 0/4] grep: support to match by line number
Date: Mon, 2 May 2011 20:54:16 +0200	[thread overview]
Message-ID: <BANLkTinVvJgE0+gxm8SdDi30-a11P2HnNA@mail.gmail.com> (raw)
In-Reply-To: <7vfwoxoy5c.fsf@alter.siamese.dyndns.org>

On Mon, May 2, 2011 at 18:38, Junio C Hamano <gitster@pobox.com> wrote:
> I am personally not thrilled by what this series attempts to do, but first
> a few questions:
>
>  - Are there existing non-git "grep" implementations that do this?

I didn't know of any, until Jakub mentioned the ack tool. And I didn't
look for one. I will answer you 'yes'-questions only in context of my
proposal.

>
>  - If yes:
>   - what command option letter do they use to specify line number?

I have no strong argument for -@, it was short and -l and -L are
taken, but I wont use this that often on the command line, so a long
option like '--line=' is ok for me too.

>   - do they not support a range notation (e.g. -@ 25-30,32-40)?

That was already on my todo list and also mentioned in the last paragraph.

>   - what do they do when given more than one file?

Like the content patterns, they try to match.

>
>  - If no:
>   - why not?  Is it a sign that this is ill-thought out misfeature?

Printing only some lines of a file isn't that hard, and there are
obviously some standard tools which do this fine, but combining this
with the -C and --show-function feature isn't easy. So extending grep
with this feature sounds like the best bet.

>   - perhaps people use something like "sed -n -e 25,30p file" and be
>     happy?

How would you combine this with git grep HEAD or with multiple files?

Bert

  parent reply	other threads:[~2011-05-02 18:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02 11:39 [PATCH/RFC 0/4] grep: support to match by line number Bert Wesarg
     [not found] ` <cover.1304321122.git.bert.wesarg@googlemail.com>
2011-05-02 11:39   ` [PATCH/RFC 1/4] grep: prepare for re-using the space of the regexp member in struct grep_pat Bert Wesarg
2011-05-02 13:27     ` Thiago Farina
2011-05-02 14:25       ` Bert Wesarg
2011-05-02 11:39   ` [PATCH/RFC 2/4] grep: pass current line number down to match_one_pattern Bert Wesarg
2011-05-02 13:30     ` Thiago Farina
2011-05-02 14:29       ` Bert Wesarg
2011-05-02 16:40         ` Junio C Hamano
2011-05-02 11:39   ` [PATCH/RFC 3/4] grep: introduce pattern which matches at line number Bert Wesarg
2011-05-02 13:33     ` Thiago Farina
2011-05-02 14:32       ` Bert Wesarg
2011-05-02 11:39   ` [PATCH/RFC 4/4] grep: provide option to match " Bert Wesarg
2011-05-02 11:54 ` [PATCH/RFC 0/4] grep: support to match by " Sverre Rabbelier
2011-05-02 12:20   ` Bert Wesarg
2011-05-02 16:46     ` Junio C Hamano
2011-05-02 19:14       ` Bert Wesarg
2011-05-02 19:30         ` Junio C Hamano
2011-05-02 16:38 ` Junio C Hamano
2011-05-02 17:11   ` Jakub Narebski
2011-05-02 18:54   ` Bert Wesarg [this message]
2011-05-02 19:08     ` Junio C Hamano
2011-05-02 19:33       ` Bert Wesarg

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=BANLkTinVvJgE0+gxm8SdDi30-a11P2HnNA@mail.gmail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jnareb@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).