bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: grep feature request: show column numbers


From: Stepan Kasal
Subject: Re: grep feature request: show column numbers
Date: Mon, 13 Dec 2004 10:52:11 +0100
User-agent: Mutt/1.4.1i

Hallo,
  thank you for your suggestion.
The bug-report address for grep has changed to bug-grep, so I'm
moving the discussion there.

On Mon, Dec 13, 2004 at 12:52:27PM +1100, Martin Pool wrote:
> It would be nice if GNU grep had an option to show the column number
...
> % grep -nH --column GNU /etc/issue
> /etc/issue:1:8:Debian GNU/Linux 3.1 \n \l
...
> (I feel like this must have been requested before, but I can't find
> any reference to it.)

the reason may be that this can be solved with other tools.

You can use sed to remove the match and measure the reminder:

sed -n '
/pattern/ {
        =
        p
        s/pattern.*//p
}'

prints the line number, the whole line, and the line up to the first match.

If you want to use extended regular expressions, recent GNU sed supports
it via the option `-r'.

Or you can use ``grep --colour=always'' and search for the colour
delimiters, which are:

        \e[01;31m
and
        \e[00m

Hope these suggestions help you,
        Stepan Kasal




reply via email to

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