From owner-freebsd-questions@FreeBSD.ORG Fri Sep 26 12:22:19 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42C881065688 for ; Fri, 26 Sep 2008 12:22:19 +0000 (UTC) (envelope-from steve@ibctech.ca) Received: from ibctech.ca (v6.ibctech.ca [IPv6:2607:f118::b6]) by mx1.freebsd.org (Postfix) with SMTP id D50D58FC22 for ; Fri, 26 Sep 2008 12:22:18 +0000 (UTC) (envelope-from steve@ibctech.ca) Received: (qmail 2444 invoked by uid 89); 26 Sep 2008 12:22:57 -0000 Received: from unknown (HELO ?IPv6:2607:f118::5?) (steve@ibctech.ca@2607:f118::5) by 2607:f118::b6 with ESMTPA; 26 Sep 2008 12:22:57 -0000 Message-ID: <48DCD403.8010603@ibctech.ca> Date: Fri, 26 Sep 2008 08:22:27 -0400 From: Steve Bertrand User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: "freebsd-questions@freebsd.org Questions -" References: <48DCD201.2000402@ibctech.ca> In-Reply-To: <48DCD201.2000402@ibctech.ca> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: Iterate through directories and search into files X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Sep 2008 12:22:19 -0000 Steve Bertrand wrote: > Hi everyone, > > I have a list of directories: > > - a..z and 2003..2008 > > ...inside of a single directory. > > Can someone advise what the shortest shell pipeline would be to search > for two words (on two separate lines) within all files located only the > alpha directories, and then print the filename to STDOUT? ...what I meant to say was that both patterns will be on the SAME line, as a single instance example, I would do: cat a/file.fil | grep -i comment | grep 355 Steve