GNU bug report logs - #18071
grep feature request: character mode

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: grep; Severity: wishlist; Reported by: mark@HIDDEN; dated Mon, 21 Jul 2014 20:52:02 UTC; Maintainer for grep is bug-grep@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Jul 2014 20:51:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 21 16:51:31 2014
Received: from localhost ([127.0.0.1]:33721 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1X9KYU-0006ZI-Pe
	for submit <at> debbugs.gnu.org; Mon, 21 Jul 2014 16:51:31 -0400
Received: from eggs.gnu.org ([208.118.235.92]:41823)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <mark@HIDDEN>) id 1X9HiF-0000wS-28
 for submit <at> debbugs.gnu.org; Mon, 21 Jul 2014 13:49:27 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mark@HIDDEN>) id 1X9Hi0-0000RP-NV
 for submit <at> debbugs.gnu.org; Mon, 21 Jul 2014 13:49:17 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:50340)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mark@HIDDEN>) id 1X9Hi0-0000RG-Ky
 for submit <at> debbugs.gnu.org; Mon, 21 Jul 2014 13:49:08 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43432)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mark@HIDDEN>) id 1X9Hht-0007bV-1O
 for bug-grep@HIDDEN; Mon, 21 Jul 2014 13:49:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mark@HIDDEN>) id 1X9Hhm-0000LN-S0
 for bug-grep@HIDDEN; Mon, 21 Jul 2014 13:49:00 -0400
Received: from pier.ecn.purdue.edu ([128.46.154.98]:36117)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <mark@HIDDEN>) id 1X9Hhm-0000KM-O3
 for bug-grep@HIDDEN; Mon, 21 Jul 2014 13:48:54 -0400
Received: from pier.ecn.purdue.edu (localhost.ecn.purdue.edu [127.0.0.1])
 by pier.ecn.purdue.edu (8.14.4/8.14.4) with ESMTP id s6LHmq4P009789
 for <bug-grep@HIDDEN>; Mon, 21 Jul 2014 13:48:52 -0400
To: bug-grep@HIDDEN
From: Mark Senn <mark@HIDDEN>
X-Attribution: mark
Subject: grep feature request: character mode
Date: Mon, 21 Jul 2014 13:48:52 -0400
Message-ID: <9788.1405964932@HIDDEN>
X-ECN-MailServer-VirusScanned: by ecn-av-milter
X-ECN-MailServer-Origination: localhost.ecn.purdue.edu 127.0.0.1
X-ECN-MailServer-SpamScanAdvice: DoNotScan
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 21 Jul 2014 16:51:29 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: mark@HIDDEN
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

I'd like a new feature added to grep to show some characters
before and after a match and a way to advance the current
position in a line to start matching again.

Conceptually I would like for it to work like the following.

Usually grep processes a line at a time.  In charcter mode grep reads a
line at time and starts at the beginning of a line looking for the
regular expression.  Call where the regular expression starts matching
start and sstart and where it ends end and eend.

Add the following options or equivalennt:

    --char-before-context-regex
        Print num characters of of leading context after matching
        a regular expression.

    --char-after-context-regex
        Print num characters of trailing context after matching
        a regular expression.

    --char-skip-regex


EXPLANATION OF HOW THE OPTIONS WORK

(This is the start of the character loop.)

If --char-before-context-regex is set try to match such that it ends at
character start-1.  If it matches call the position it starts sstart.

If --char-after-context-regex is set try to match such that it starts at
character end-1.  If it matches call the position it ends eend.

Print characters at positions sstart--eend.

Beginning at start, try to match --char-skip-regex.  If it matches
set start to the position of the character after this match and go
to "(This is the start of the character loop.)".

I've wanted grep to be able to do character context for a long time,
looked at the code and said to myself, adding it would be a major
undertaking for me because I'm not familiar with the code.  If you
would add it that would be great.

Mark Senn, Systems Programmer, Engineering Computer Network, Purdue University




Acknowledgement sent to mark@HIDDEN:
New bug report received and forwarded. Copy sent to bug-grep@HIDDEN. Full text available.
Report forwarded to bug-grep@HIDDEN:
bug#18071; Package grep. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.