From owner-freebsd-questions Thu Oct 4 17:46:57 2001 Delivered-To: freebsd-questions@freebsd.org Received: from ns1.avatar.com (ns1.avatar.com [199.33.206.1]) by hub.freebsd.org (Postfix) with ESMTP id DB9B537B405 for ; Thu, 4 Oct 2001 17:46:52 -0700 (PDT) Received: from tomcat (tomcat.avatar.com [199.33.206.20]) by ns1.avatar.com (Postfix) with SMTP id 8D8E2A4B07 for ; Thu, 4 Oct 2001 17:46:52 -0700 (PDT) From: "Kory Hamzeh" To: Subject: Real dumb shell script/awk question Date: Thu, 4 Oct 2001 17:46:53 -0700 Message-ID: <001201c14d37$3a59fac0$14ce21c7@avatar.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I need to bang together a simple shell script to parse a flat ascii database. The fields are variable width, but each field is separated by the "|" character. Basically, all this script needs to do is to read the database, one line at a line, and if field X is equal to value Y, then print the value of field Z. The user must be able to specify X, Y, and Z on the command line. Now, for the life of me, I can't seem to figure out a simple way of doing this with a bourne shell script. I think awk can do it, but the man pages didn't help me too much with the language. I know other language, like perl, are probably better suited, but I need to customize this script per the clients request, and it will only be needed for a couple of weeks and he'll never need this again. Any tips on how to do this? I'm sure there is a simple way and I'm drawing a blank. Thanks, Kory To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message