Subject: grep -o fails to count empty lines (Debain Bug #532541)
From: "Santiago R.R." <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Thu, 3 Aug 2017 15:28:14 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

(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