X-Loop: help-debbugs@HIDDEN Subject: bug#18071: grep feature request: character mode Resent-From: Mark Senn <mark@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 21 Jul 2014 20:52:02 +0000 Resent-Message-ID: <handler.18071.B.140597589125258 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 18071 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 18071 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-grep@HIDDEN Reply-To: mark@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.140597589125258 (code B ref -1); Mon, 21 Jul 2014 20:52:02 +0000 Received: (at submit) by debbugs.gnu.org; 21 Jul 2014 20:51:31 +0000 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 From: Mark Senn <mark@HIDDEN> X-Attribution: mark 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-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 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
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: mark@HIDDEN Subject: bug#18071: Acknowledgement (grep feature request: character mode) Message-ID: <handler.18071.B.140597589125258.ack <at> debbugs.gnu.org> References: <9788.1405964932@HIDDEN> X-Gnu-PR-Message: ack 18071 X-Gnu-PR-Package: grep Reply-To: 18071 <at> debbugs.gnu.org Date: Mon, 21 Jul 2014 20:52:03 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-grep@HIDDEN If you wish to submit further information on this problem, please send it to 18071 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 18071: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D18071 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.