From owner-freebsd-questions@FreeBSD.ORG Tue Mar 6 15:59:33 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org 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 41A4F16A400 for ; Tue, 6 Mar 2007 15:59:33 +0000 (UTC) (envelope-from freebsd@scottevil.com) Received: from pro28.abac.com (pro28.abac.com [66.226.64.29]) by mx1.freebsd.org (Postfix) with ESMTP id 1751D13C461 for ; Tue, 6 Mar 2007 15:59:33 +0000 (UTC) (envelope-from freebsd@scottevil.com) Received: from [10.34.1.89] ([64.126.14.3]) (authenticated bits=0) by pro28.abac.com (8.13.6/8.13.6) with ESMTP id l26FTt2v052720; Tue, 6 Mar 2007 07:29:57 -0800 (PST) (envelope-from freebsd@scottevil.com) Message-ID: <45ED88F3.8040200@scottevil.com> Date: Tue, 06 Mar 2007 09:29:55 -0600 From: Scott Oertel User-Agent: Thunderbird 2.0b1 (X11/20061211) MIME-Version: 1.0 To: Gary Kline References: <20070306003506.GA12553@thought.org> In-Reply-To: <20070306003506.GA12553@thought.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 4.446 (RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_XBL) X-Spam-Level: !!!! Cc: FreeBSD Mailing List Subject: Re: awk question 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, 06 Mar 2007 15:59:33 -0000 Gary Kline wrote: > Guys, > > Having found $9 , how do I /bin/rm it (using system()--yes??) > in an awk one-liner? > > I'm trying to remove from packages from long ago and find and > print them with > > ls -lt | awk '{if ($8 == 2006) print $9}'; > > but what I want to remove the file pointed at by $9. I've tried > FILE=ARGV[9]; and using FILE within my system() call, but no-joy. > What's the magic here? > > thanks in advance, > > gary > > > > Another way is: ls -lt | awk '{if ($8 == 2006) print "rm -rf "$9}' | sh but I agree, using pkg_delete would be safer: ls -lt | awk '{if ($8 == 2006) print "pkg_delete "$9}' | sh -SO