From owner-freebsd-questions@FreeBSD.ORG Thu Aug 12 12:38:59 2010 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 A55AE1065674 for ; Thu, 12 Aug 2010 12:38:59 +0000 (UTC) (envelope-from jacks@sage-american.com) Received: from mail.sagedata.net (mail.sagedata.net [38.106.15.121]) by mx1.freebsd.org (Postfix) with ESMTP id 7EB4D8FC08 for ; Thu, 12 Aug 2010 12:38:59 +0000 (UTC) Received: from sagemaster (sageweb.net [65.68.247.73]) by mail.sagedata.net (8.14.4/8.14.4) with SMTP id o7CCcwhA055615; Thu, 12 Aug 2010 07:38:58 -0500 (CDT) (envelope-from jacks@sage-american.com) X-Authentication-Warning: mail.sagedata.net: Host sageweb.net [65.68.247.73] claimed to be sagemaster Message-Id: <3.0.1.32.20100812073855.00ec5e98@sage-american.com> X-Sender: jacks@sage-american.com X-Mailer: Windows Eudora Pro Version 3.0.1 (32) Date: Thu, 12 Aug 2010 07:38:55 -0500 To: ashish@FreeBSD.org (Ashish SHUKLA) From: "Jack L. Stone" In-Reply-To: <86bp98dpj0.fsf@chateau.d.if> References: <3.0.1.32.20100811180022.00ee4250@sage-american.com> <3.0.1.32.20100811180022.00ee4250@sage-american.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Scanned-By: milter-spamc/1.15.388 (mail.sagedata.net [38.106.15.121]); Thu, 12 Aug 2010 07:38:58 -0500 X-Scanned-By: milter-sender/1.16.915 (mail.sagedata.net [38.106.15.121]); Thu, 12 Aug 2010 07:38:58 -0500 X-Spam-Status: NO, hits=-10.00 required=4.50 X-Spam-Report: Content analysis details: (-10.0 points, 4.5 required) | | pts rule name description | ---- ---------------------- -------------------------------------------------- | -0.0 SHORTCIRCUIT Not all rules were run, due to a shortcircuited rule | -10 ALL_TRUSTED Passed through trusted hosts only via SMTP | Cc: freebsd-questions@FreeBSD.org Subject: Re: Grepping a list of words 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: Thu, 12 Aug 2010 12:38:59 -0000 At 05:14 PM 8.12.2010 +0530, Ashish SHUKLA wrote: >Jack L Stone writes: >> Kindly appreciate help with how to grep (or similar) a list of words to >> determine if any of them are in a file rather than grepping one word at a >> time. > >#v+ >% egrep 'word1|word2|word3|...|wordn' filename.txt >#v- > >'word1|word2|word3|...|wordn' is the regular expression, so if you can >minimize it better for you :). > >HTH >-- >Ashish SHUKLA | GPG: F682 CDCC 39DC 0FEA E116 20B6 C746 CFA9 E74F A4B0 Thanks for the replies. This suggestion won't do the job as the list of words is very long, maybe 50-60. This is why I asked how to place them all in a file. One reply dealt with using a file with egrep. I'll try that. Appreciate the help and any others in case the one doesn't work. All the best, Jack (^_^) Happy trails, Jack L. Stone System Admin Sage-american