X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 	tests=AWL,BAYES_00
X-Spam-Check-By: sourceware.org
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain; 	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
Subject: RE: Why doesn't "find .|grep aword" work?
Date: Mon, 6 Jul 2009 12:18:43 -0500
Message-ID: <786EBDA1AC46254B813E200779E7AD3618F0C9@srv1163ex1.flightsafety.com>
In-Reply-To: <24359078.post@talk.nabble.com>
References: <24359078.post@talk.nabble.com>
From: "Thrall, Bryan" <bryan.thrall@flightsafety.com>
To: <cygwin@cygwin.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

km4hr wrote on Monday, July 06, 2009 12:13 PM:
> Do pipes work in cygwin in the usual way?
>=20
> Why doesn't the following command works on HP Unix? Why not cygwin?
>=20
> find .|grep "hello"
>=20
> I get no output from this command even though I'm sure the word
"hello" is
> in some files.
>=20
> What I want this command to do is find all files in all
sub-directories and
> pipe the output to grep. Grep then looks in each file for the word
"hello".
> The names of files that contain the word "hello" should be returned.
>=20
> thanks.

Your command has grep search the list of files for "hello", not the
contents of those files.

Try this:

find . | xargs grep "hello"

This is not a Cygwin-specific question, BTW.

HTH,
--=20
Bryan Thrall
FlightSafety International
bryan.thrall@flightsafety.com

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

