From owner-freebsd-questions@FreeBSD.ORG Fri Sep 26 12:36:09 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 D0CE6106568D for ; Fri, 26 Sep 2008 12:36:09 +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 5DBE58FC22 for ; Fri, 26 Sep 2008 12:36:09 +0000 (UTC) (envelope-from steve@ibctech.ca) Received: (qmail 2857 invoked by uid 89); 26 Sep 2008 12:36:47 -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:36:47 -0000 Message-ID: <48DCD740.2000305@ibctech.ca> Date: Fri, 26 Sep 2008 08:36:16 -0400 From: Steve Bertrand User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Mel References: <48DCD201.2000402@ibctech.ca> <48DCD403.8010603@ibctech.ca> <200809261432.17656.fbsd.questions@rachie.is-a-geek.net> In-Reply-To: <200809261432.17656.fbsd.questions@rachie.is-a-geek.net> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org 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:36:09 -0000 Mel wrote: > On Friday 26 September 2008 14:22:27 Steve Bertrand wrote: >> 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 > > find ./[a-z]* -type f -exec grep -il 'comment.*355' {} + Beautiful, thanks! Steve