[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch #7577] `grep -lc' to show only matching files
From: |
Santiago Ruano Rincón |
Subject: |
[patch #7577] `grep -lc' to show only matching files |
Date: |
Wed, 13 Jul 2011 23:56:26 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0 Iceweasel/5.0 |
URL:
<http://savannah.gnu.org/patch/?7577>
Summary: `grep -lc' to show only matching files
Project: grep
Submitted by: santiago
Submitted on: mié 13 jul 2011 23:56:25 GMT
Category: None
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Peter Samuelson has submitted a patch to Debian to modify the behavior of
`grep -lc'. Copying what he wrote in http://bugs.debian.org/76011
-----------------------------------------------------------------
Okay, grep has two very useful options, -l and -c:
-l, --files-with-matches only print FILE names containing matches
-c, --count only print a count of matching lines per FILE
It seems only logical that 'grep -lc' would count the matching lines per file,
but skip files with no matches. Obvious, right? (: But the status quo is that
'grep -lc' gives garbled output from both options, i.e. "undefined behavior".
Fortunately, it's a simple change. Would seven lines of source bloat be
considered unacceptible? Note that this change isn't just for theoretical
consistency -- I find it very practical. Because otherwise I am forever
saying
grep -c ..... | grep -v :0
-----------------------------------------------------------------
I think his patch is correct and useful. Could you please consider this patch?
Thanks,
Santiago
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: mié 13 jul 2011 23:56:25 GMT Name: grep-lc.patch Size: 1kB By:
santiago
<http://savannah.gnu.org/patch/download.php?file_id=23650>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/patch/?7577>
_______________________________________________
Mensaje enviado vía/por Savannah
http://savannah.gnu.org/
- [patch #7577] `grep -lc' to show only matching files,
Santiago Ruano Rincón <=