Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Mar 2007 16:58:20 -0800
From:      Gary Kline <kline@tao.thought.org>
To:        Chuck Swiger <cswiger@mac.com>
Cc:        Gary Kline <kline@tao.thought.org>, FreeBSD Mailing List <freebsd-questions@FreeBSD.ORG>
Subject:   Re: awk question
Message-ID:  <20070306005820.GC12600@thought.org>
In-Reply-To: <880C4678-6B40-44C7-A643-4F2FD9F35DBC@mac.com>
References:  <20070306003506.GA12553@thought.org> <880C4678-6B40-44C7-A643-4F2FD9F35DBC@mac.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 05, 2007 at 04:46:35PM -0800, Chuck Swiger wrote:
> On Mar 5, 2007, at 4:35 PM, Gary Kline wrote:
> >	Having found $9 , how do I /bin/rm it (using system()--yes??)
> >	in an awk one-liner?
> 
> I gather that you are looking under /var/db/pkg...?
> 
> >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?
> 
> You could pipe the output of awk through "| xargs rm -rf"...but be  
> careful.
> Putting it through "pkg_delete (-f)" might be safer.
> 


	Bill and Chuck:

	These are a slew of packages from 2006.  (Obv'ly in 
	/usr/ports/packages.  I plumb fergot about xargs (again);
	just rarely use it.  

	ls -lt | awk Foo catches those that are almost certainly invalid,
	from '06) but the find -mtime [days] is another way.  Like they 
	say about perl, there's always more than one way...  When you've 
	got Unix, you've got power at your fingertips.

	thanks, gents,

	gary



> -- 
> -Chuck
> 

-- 
  Gary Kline  kline@thought.org   www.thought.org  Public Service Unix




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070306005820.GC12600>