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

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

Re: gnu grep - no bug report but feature suggestion (dunno if right here


From: Alain Magloire
Subject: Re: gnu grep - no bug report but feature suggestion (dunno if right here,
Date: Sat, 24 Nov 2001 12:55:04 -0500 (EST)

Bonjour

> Hello,
> 
> I do not know if this is the right place to make a suggestion about a
> simple new feature for GNU grep but I did not find any other place for
> it so I just try :-).
> 
> Today I needed to filter some output for Data and came about the problem
> to do something like
> 
> grep -e '([0-9]{1;3}.){3}[0-9]{1;3}' mydata
> 
> to get out an IP-address from data. Now I did not need the whole line
> where it is but just the String that matched the Expression - and so I
> studied the grep manpage and found out: there seems to be none. Maybe I
> just did not see it, but reading the whole thing again did not show so.

Yes, that's correct, there is no such option.
Traditionnaly, grep works on lines.

> I mean, there are options to get the line with the Match, lines bevore
> and after the Match, lines without the Match, the filename of the Match
> and the position of the Match, the count of Matches at all - but no
> simple Way to get just the Matching Text itself and nothing else.
> 
> Of course, I solve my Problem by using sed, but I decided to suggest to
> you to implement an additional command line Switch to grep to make this
> possible, too since it was intuitively the first Place I would look for
> something like this. Since one can already get the position of the Match
> I do not think this should be very much work to implement - I am sorry I
> cannot provide you a patch already because my programming skills in C
> are not so high.

The new option --color does this by rerunning the matcher engine
again to extract, which is a penality.  But maybe it would be better to do it
"properly" this time 8).  The new maintainer did put some new betas on alpha
maybe you can bring this to his attention.






reply via email to

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