buggrep - Bugs: bug #22100, Enhancement request: "grep...

 
 

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

bug #22100: Enhancement request: "grep foo | grep bar" in one process (i.e. line-selector and pattern selector)

Submitted by:  Richard Neill <richardneill>
Submitted on:  Thu 24 Jan 2008 04:45:22 AM UTC  
 
Category:  None Severity:  1 - Wish
Item Group:  None Status:  Wont Fix
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Thu 02 Dec 2010 09:24:34 PM UTC, comment #1: 
Paolo Bonzini <bonzini>
Thu 24 Jan 2008 04:45:22 AM UTC, original submission:  

I frequently find myself writing a construct of the type:
  grep LINE_MATCH filename | grep -oE WORD_MATCH

For example, consider a data file:

  apples: 12
  oranges: 15
  bananas: 20

How many oranges do I have?

  grep oranges fruit.txt | grep -oE [0-9]+

results in "15".

But I had to run 2 instances of the grep command, which is inefficient. (This is noticeable even for small files, even on a fast machine). 

So my proposal is to have some extra options to grep, eg:
  grep --line oranges --pattern -oE [0-9]+  fruit.txt

Alternatively, what about allowing multiple instances of -E, or supporting --first --second --third ?

Thanks very much,

Richard

Richard Neill <richardneill>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bonzini (Updated the item)
  • -email is unavailable- added by richardneill (Submitted the item)
  • -email is unavailable- added by richardneill
  •  

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

    Only logged-in users can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-12-02 bonzini StatusNone => Wont Fix
        Open/ClosedOpen => Closed
    2009-12-04 bonzini Severity3 - Normal => 1 - Wish
    2008-01-24 richardneill Carbon-Copy- => Added rn214@cam.ac.uk

    Back to the top


    Powered by Savane 3.6