buggrep - Bugs: bug #23936, grep with "near" and...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

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

Submitted by:  None
Submitted on:  Fri 25 Jul 2008 07:34:23 PM UTC  
 
Category: NoneSeverity: 1 - Wish
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Fri 25 Jul 2008 07:34:23 PM UTC, original submission:

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.

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bonzini (Updated the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 04 Dec 2009 07:22:17 PM UTCbonziniSeverity3 - Normal=>1 - Wish

    Back to the top


    Powered by Savane 3.1-cleanup