bug-grep
[Top][All Lists]
Advanced

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

[bug #23936] grep with "near" and "far-from" support


From: anonymous
Subject: [bug #23936] grep with "near" and "far-from" support
Date: Fri, 25 Jul 2008 19:34:25 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0

URL:
  <http://savannah.gnu.org/bugs/?23936>

                 Summary: grep with "near" and "far-from" support
                 Project: grep
            Submitted by: None
            Submitted on: Friday 07/25/2008 at 19:34 UTC
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

It'd be really nice if grep could also search context.  In my case, I'm
looking for USING with JOIN nearby.  I'm adapting SQL code that is about to be
converted from MySQL 4 to MySQL 5, but I need to clarify USING's.

I'd like to be able to do this:

grep -niR using --nearby-match=join --nearby-lines-before=3

I can also see how it'd be useful to look for strings that are "far from"
other strings (the --far-from string is not found in the context described in
the --far-from-lines list)

I suggest the following new parameters:

--far-from=<match string>  Requires that match string is not in
                           nearby context.
--near=<match string>      Requires the match string in nearby
                           context
--near-lines=<n>           Sets nearby context to the matching
                           line and the n lines before and
                           after.
--near-lines-before=<n>    Works like --context-before
                           specifically for nearby matches.
--near-lines-after=<n>     As above, but after.
--near-expands-context     Context display expanded to include
                           nearby matches (treats nearby matches
                           as the match line).

On implementation - I think it'd be pretty easy to recursively grep primary
match strings for near and far matches to determine if a primary match meets
follow-up criteria.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?23936>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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