[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #22100] Enhancement request: "grep foo | grep bar" in one process (
From: |
Richard Neill |
Subject: |
[bug #22100] Enhancement request: "grep foo | grep bar" in one process (i.e. line-selector and pattern selector) |
Date: |
Thu, 24 Jan 2008 04:45:25 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.11) Gecko/20061201 Firefox/2.0.0.11 (Ubuntu-feisty) |
URL:
<http://savannah.gnu.org/bugs/?22100>
Summary: Enhancement request: "grep foo | grep bar" in one
process (i.e. line-selector and pattern selector)
Project: grep
Submitted by: richardneill
Submitted on: Thursday 24/01/08 at 04:45
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
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
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?22100>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug #22100] Enhancement request: "grep foo | grep bar" in one process (i.e. line-selector and pattern selector),
Richard Neill <=