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)

Submitter:  Richard Neill <richardneill>
Submitted:  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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

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
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    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 -email is unavailable-

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code