awk question

Chuck Swiger cswiger at
Tue Mar 6 00:46:36 UTC 2007

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  
Putting it through "pkg_delete (-f)" might be safer.


More information about the freebsd-questions mailing list