Date: Sun, 06 Aug 2006 23:23:14 +0100 From: Howard Jones <howie@thingy.com> To: Gary Kline <kline@tao.thought.org>, freebsd-questions@freebsd.org Subject: Re: [freebsd-questions] awk quickie. Message-ID: <44D66BD2.8050305@thingy.com> In-Reply-To: <20060806221015.GA1039@thought.org> References: <20060806221015.GA1039@thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44D66BD2.8050305>