From owner-freebsd-questions Tue Feb 8 17:57: 7 2000 Delivered-To: freebsd-questions@freebsd.org Received: from s1.ds.net (s1.ds.net [207.239.204.1]) by builder.freebsd.org (Postfix) with ESMTP id 2731C457A for ; Tue, 8 Feb 2000 14:47:54 -0800 (PST) Received: from ds.net (i1p74.cmh-oh.ds.net [207.239.205.74]) by s1.ds.net (8.8.5/8.8.5) with ESMTP id PAA13551; Tue, 8 Feb 2000 15:54:24 -0500 (EST) Message-ID: <38A0828F.6E5E703C@ds.net> Date: Tue, 08 Feb 2000 15:54:39 -0500 From: "James A. Mutter" Reply-To: jmutter@ds.net X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.0.36 i386) X-Accept-Language: en MIME-Version: 1.0 To: darryl@osborne-ind.com Cc: freebsd-questions@FreeBSD.ORG Subject: Re: OFF TOPIC - Shell Script Question References: <001101bf7273$e44dc250$070101c0@ruraltel.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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. :) 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' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message