From owner-freebsd-questions@FreeBSD.ORG Tue Jul 10 14:23:26 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5BA611065674 for ; Tue, 10 Jul 2012 14:23:26 +0000 (UTC) (envelope-from alexmiroslav@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 1A0728FC22 for ; Tue, 10 Jul 2012 14:23:26 +0000 (UTC) Received: by yhfs35 with SMTP id s35so25844yhf.13 for ; Tue, 10 Jul 2012 07:23:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=NyJMpL/EnsNg+Z0do4lfqjG3LuPmq3OIM+GWQdbni7M=; b=z09RhvcKvkkxDCC3jnzt8YhgP/7HVG5sEGgI6XrDN9FW/4Rb6iGyjdj8YGZ5hkb/27 iXTcTvAeuaE4TukzTqfX1MD4BBy/nOXcLcGulM/iZfGpY2Nq0hkxWU2sJqndX8eWn7+Q HXCUYUJLmnlojkbHs2sAq7D+gvGunh98DjfUPTAiTu473j+P7Ng6PL1KVuRFHn/LgxBq 5/RlNrttZ+cONItkKg5b8BYRhbKzy+OYXqv7Ofkm/JgaakC4iyYpQUxbmfIYVX3h2FTa 1oIBJXykjVYTEeC3yPgZ3X1Z9YcNW9+o3dD43F1bCf3S9TgtBimDgkVsH1Jcu+KR9EIf c9Og== MIME-Version: 1.0 Received: by 10.60.3.102 with SMTP id b6mr46217425oeb.35.1341930205546; Tue, 10 Jul 2012 07:23:25 -0700 (PDT) Received: by 10.60.143.104 with HTTP; Tue, 10 Jul 2012 07:23:25 -0700 (PDT) Date: Tue, 10 Jul 2012 10:23:25 -0400 Message-ID: From: Aleksandr Miroslav To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: shell scripting: grepping multiple patterns, logically ANDed (solved) 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: Tue, 10 Jul 2012 14:23:26 -0000 On Sat, Jun 30, 2012 at 4:23 PM, Giorgos Keramidas wrote: > > Is there an easier/shorter way to do this? If there are 15 arguments > > supplied on the command line, I don't necessarily want to build 15 if > > statements. > > The solutions proposed so far are ok, if you really *have* to stick to a > shell script. [...] > I'd write this sort of logic in python Thanks to everyone who responded. I think Giorgos' suggestion to move away from a shell script was the most elegant one, and I rewrote my script in Python (plagiarizing most of his code in the meantime) and it works great. Ironically, it runs even faster than the /bin/sh + find(1) version, go figure. Thanks again, Alex