On 08/03/2010 05:39 AM, Andre Majorel wrote: > On 2010-08-03 19:37 +0800, Zhang Weiwu wrote: >> On 2010???08???03??? 17:53, Andre Majorel wrote: >>>>> $ printf 'a\nb' | grep -zo a.*b >>>>> >>>>> (The above should output something /if/ -z would make egrep >>>>> not consider \n as string terminator. But it has produced no >>>>> output) >>>> >>> But grep -z does. This would seem to be an undocumented >>> limitation of -o. >>> >> >> No it doesn't. >> >> $ printf 'a\nb' | grep -z 'a.*b' >> $ > > You're welcome. What version of grep ? >
The -z "sort of" does/doesn't work for me. If I do this: $ perl -e 'print "a\nb\0"'| grep -z 'a.*b' $ There's no output. But change it like this: $ perl -e 'print "a\nb\0"'| grep -z 'a' a b$ It found, and printed, the newline containing string. I would suspect the regex engine is still honoring '. (dot) does not match newline' convention but is OK with literals, if present. If, instead of using the '.*' pattern, I embed a literal newline, it also works: $ perl -e 'print "a\nb\0"'| grep -z 'a > b' a b$ And just to prove the point, it does work with multiple null terminated lines: perl -e 'print "a\nb\0not here\0"'| grep -z 'a > b' a b$ I'm using GNU grep 2.5.3 -- Bob McGowan -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/4c584a92.70...@symantec.com