From owner-freebsd-questions@FreeBSD.ORG Sun Aug 6 22:23:24 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 77CD416A4DA for ; Sun, 6 Aug 2006 22:23:24 +0000 (UTC) (envelope-from howie@thingy.com) Received: from post1.inband.network-i.net (post1.inband.network-i.net [212.21.96.19]) by mx1.FreeBSD.org (Postfix) with SMTP id B180043D45 for ; Sun, 6 Aug 2006 22:23:23 +0000 (GMT) (envelope-from howie@thingy.com) Received: (qmail 89691 invoked from network); 6 Aug 2006 22:23:21 -0000 Received: from unknown (HELO ?10.0.0.16?) (212.46.145.34) by post1.inband.network-i.net with SMTP; 6 Aug 2006 22:23:21 -0000 Message-ID: <44D66BD2.8050305@thingy.com> Date: Sun, 06 Aug 2006 23:23:14 +0100 From: Howard Jones User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: Gary Kline , freebsd-questions@freebsd.org References: <20060806221015.GA1039@thought.org> In-Reply-To: <20060806221015.GA1039@thought.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Re: [freebsd-questions] awk quickie. 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: Sun, 06 Aug 2006 22:23:24 -0000 Gary Kline wrote: > Guys, > > Can aanybody spot what I'm doing wrong in this tiny awk scripy:: > Using awk is what you are doing wrong ;-) Assuming that this is all you are doing with the list, anyway... From the grep manpage: " -l, --files-with-matches Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match." The awk answer is that the printf shouldn't be in the BEGIN section, I think. It's been a while for me and awk though. Something more like: #!/usr/bin/awk BEGIN { FS = ":" } { printf("%s\n", $1) } would do it. Also see cut(1) which can select fields based on delmiters. I don't know if the traditional perception of 'heaviness' associated with loading a 'real language' interpreter really hold true nowadays though. Have fun! Howie