From owner-freebsd-questions@FreeBSD.ORG Sun Aug 6 22:47:53 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 B07B016A4DF for ; Sun, 6 Aug 2006 22:47:53 +0000 (UTC) (envelope-from kline@tao.thought.org) Received: from tao.thought.org (dsl231-043-140.sea1.dsl.speakeasy.net [216.231.43.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0537F43D46 for ; Sun, 6 Aug 2006 22:47:52 +0000 (GMT) (envelope-from kline@tao.thought.org) Received: from tao.thought.org (localhost [127.0.0.1]) by tao.thought.org (8.13.4/8.13.1) with ESMTP id k76Mldnw001300; Sun, 6 Aug 2006 15:47:40 -0700 (PDT) (envelope-from kline@tao.thought.org) Received: (from kline@localhost) by tao.thought.org (8.13.4/8.13.1/Submit) id k76MlbL2001295; Sun, 6 Aug 2006 15:47:37 -0700 (PDT) (envelope-from kline) Date: Sun, 6 Aug 2006 15:47:32 -0700 From: Gary Kline To: Howard Jones Message-ID: <20060806224732.GA1255@thought.org> References: <20060806221015.GA1039@thought.org> <44D66BD2.8050305@thingy.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44D66BD2.8050305@thingy.com> User-Agent: Mutt/1.4.2.2i X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: Observing twenty years of service to the Unix community Cc: Gary Kline , freebsd-questions@freebsd.org Subject: Howto insert string. (Was: 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:47:53 -0000 On Sun, Aug 06, 2006 at 11:23:14PM +0100, Howard Jones wrote: > 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. > Thanks much! I *did* learn that with just FS, no need "END". Maybe you can help me figure out what I'm trying to do because I'm wedged!! I've got 80 or so html/php files. Most do have but a whole slew do not/are missing the BG color code. So is there some scripto-magic way of finding out which fles are missing the above string? I know how, using an ed/ex script to insert this string. My hacker brain seems to be on strike! gary > Have fun! > > Howie > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" -- Gary Kline kline@thought.org www.thought.org Public service Unix