From owner-freebsd-questions Wed Feb 9 1: 6:35 2000 Delivered-To: freebsd-questions@freebsd.org Received: from cc942873-a.ewndsr1.nj.home.com (cc942873-a.ewndsr1.nj.home.com [24.2.89.207]) by builder.freebsd.org (Postfix) with ESMTP id E2C094331 for ; Tue, 8 Feb 2000 21:43:08 -0800 (PST) Received: (from cjc@localhost) by cc942873-a.ewndsr1.nj.home.com (8.9.3/8.9.3) id AAA66992; Wed, 9 Feb 2000 00:47:01 -0500 (EST) (envelope-from cjc) Date: Wed, 9 Feb 2000 00:47:01 -0500 From: "Crist J. Clark" To: "James A. Mutter" Cc: darryl@osborne-ind.com, freebsd-questions@FreeBSD.ORG Subject: Re: OFF TOPIC - Shell Script Question Message-ID: <20000209004700.B64938@cc942873-a.ewndsr1.nj.home.com> Reply-To: cjclark@home.com References: <001101bf7273$e44dc250$070101c0@ruraltel.net> <38A0828F.6E5E703C@ds.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <38A0828F.6E5E703C@ds.net>; from jmutter@ds.net on Tue, Feb 08, 2000 at 03:54:39PM -0500 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Feb 08, 2000 at 03:54:39PM -0500, James A. Mutter wrote: > Darryl Hoar wrote: > > > > Greetings, > > I have a directory with a ton of files in it. I need to move some of > > them to another > > directory. Here's what I'm thinking: > > > > ls -tl | grep '1999' | awk '{print "mv " $9 " /home/darryl/test"}' > > > > but it does not 'execute' the mv command. How do I get this cooking ? > > > > And it's not going to execute the 'mv' command - no matter how hard you > try. :) Sure it will, % ls -tl | grep '1999' | awk '{ system("mv " $9 " /home/darryl/test") }' Of course doing that grep in front of awk is awfully silly, % ls -tl | awk '/1999/ { system("mv " $9 " /home/darryl/test") }' > Instead, try something like this: > > for i in `ls -t`; do > mv $i /home/darryl/test > fi > > There are other ways to do this too - but I thought it might be useful > to see how a simple loop works in 'sh' There are far too many ways to do this. I will now procede to illustrate them all... *Oof* NO CARRIER -- Crist J. Clark cjclark@home.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message