Package: grep
Version: 2.5.3~dfsg-6
Severity: normal

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
~$ 

In other versions, including 2.5.1 on Etch, grep -o ^$ would return exactly the 
same as grep ^$, ie one empty line for each search hit.

Normally with -o each successful hit is printed on a new line, but in this case 
it looks like grep thinks there is nothing to return so no new lines are 
produced.  I realise that exactly what grep should return when searching for 
the beginning of a line followed by an end of line may not be immediately 
clear, but I whould think a 'null' would be sufficient for each hit.

-- System Information:
Debian Release: 5.0.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.28.7mathstat (SMP w/1 CPU core)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages grep depends on:
ii  libc6                         2.7-18     GNU C Library: Shared libraries

grep recommends no packages.

grep suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to