emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#27931: closed (grep -o fails to count empty lines


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#27931: closed (grep -o fails to count empty lines (Debain Bug #532541))
Date: Thu, 03 Aug 2017 20:18:02 +0000

Your message dated Thu, 3 Aug 2017 13:16:52 -0700
with message-id <address@hidden>
and subject line Re: bug#27931: grep -o fails to count empty lines (Debain Bug 
#532541)
has caused the debbugs.gnu.org bug report #27931,
regarding grep -o fails to count empty lines (Debain Bug #532541)
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
27931: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=27931
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: grep -o fails to count empty lines (Debain Bug #532541) Date: Thu, 3 Aug 2017 15:28:14 +0200
(Sorry if it's already filed, but I am unable to find it in the
bug archives)

Hi,

I'd like to forward this bug reported to Debian some years ago.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=532541
It still happens in 3.1.

Quoting the original report:

When grepping for empty lines in a text file, grep works correctly in
most cases:

~$ grep ^$ myfile.txt 





~$ grep -n ^$ myfile.txt 
11:
15:
19:
21:
22:

However the -o option, which is supposed to return only the matching
parts of the search, fails:

~$ grep -o ^$ myfile.txt 
~$ grep -no ^$ myfile.txt
~$ 


Thanks,

Santiago



--- End Message ---
--- Begin Message --- Subject: Re: bug#27931: grep -o fails to count empty lines (Debain Bug #532541) Date: Thu, 3 Aug 2017 13:16:52 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1
On 08/03/2017 06:28 AM, Santiago R.R. wrote:
the -o option, which is supposed to return only the matching
parts of the search, fails:

It's not failing. It's behaving as documented: -o outputs only nonempty matches. Otherwise, commands like 'grep -o "a*"' would output a separate line for each byte in the input. Although this behavior for -o is longstanding and is documented in the manual, it's not in the grep --help output so that's an oversight. I installed the attached to fix grep --help, and am closing the bug report on the GNU side.

Users who want to match empty lines can use 'grep "^$"', which is what I'd expect them to do anyway (-o would be superfluous there even if it included empty matches).

Attachment: 0001-doc-improve-o-help.patch
Description: Text Data


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]