Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Aug 2008 13:32:04 -0700
From:      Chuck Swiger <cswiger@mac.com>
To:        Andrey Chernov <ache@nagual.pp.ru>
Cc:        G?bor K?vesd?n <gabor@freebsd.org>, FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: bsd-grep-20080725_1 -v flag busted...
Message-ID:  <F27A7002-ED04-4A67-A95B-C45782700FD4@mac.com>
In-Reply-To: <20080804201806.GA50143@nagual.pp.ru>
References:  <56E45E0F-29D4-4CA8-9936-384405AB874A@mac.com> <4897518D.4090001@FreeBSD.org> <20080804201806.GA50143@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Aug 4, 2008, at 1:18 PM, Andrey Chernov wrote:
>> echo 'fee\nfi\nfoe\nfum' | ./grep -v fi
>> echo 'fee\nfi\nfoe\nfum' | /usr/bin/grep -v fi
>
> Example is broken, echo (for sh) supposed to be
>
> echo 'fee
> fi
> foe
> fum' | ...

Well, if your shell's built-in echo doesn't grok newlines, then /usr/ 
bin/printf works, as Daniel suggested.  But using /bin/sh and a  
multiline statement as you suggest shows the exact same problem:

% echo 'fee
 > fi
 > foe
 > fum' | ./grep -v fi
% echo 'fee
 > fi
 > foe
 > fum' | /usr/bin/grep -v fi
fee
foe
fum

(I'm much more interested in confirming whether the bug I see in BSD  
grep is reproducible by others than debating how to get real newlines  
from various shells.)

-- 
-Chuck




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F27A7002-ED04-4A67-A95B-C45782700FD4>