From owner-freebsd-questions Wed Feb 9 6:11:50 2000 Delivered-To: freebsd-questions@freebsd.org Received: from rtso200.ruraltel.net (rtso200.ruraltel.net [24.225.0.1]) by builder.freebsd.org (Postfix) with ESMTP id B45523E4F for ; Wed, 9 Feb 2000 06:11:45 -0800 (PST) Received: from darryl ([24.225.30.210]) by rtso200.ruraltel.net (Post.Office MTA v3.5.3 release 223 ID# 0-65088U12000L2900S0V35) with SMTP id net; Wed, 9 Feb 2000 08:11:15 -0600 Reply-To: From: "Darryl Hoar" To: "'Mark Ovens'" Cc: Subject: RE: OFF TOPIC - Shell Script Question Date: Wed, 9 Feb 2000 08:11:29 -0600 Message-ID: <001201bf7285$ab614a40$070101c0@ruraltel.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Importance: Normal In-Reply-To: <20000208211737.C329@marder-1> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Thanks for all the responses. Here is what I did: create a file with owner execute permissions. #!/bin/sh for i in `ls -lt | grep $1 | awk '{print $9}'` do mv $i /home/darryl/test done Ran this with the following: bigcat> ./myscript 1995 this moved all the files dated 1995 to the directory. Once again thanks to all. -- Darryl -----Original Message----- From: Mark Ovens [mailto:mark@dogma.freebsd-uk.eu.org] Sent: Tuesday, February 08, 2000 3:18 PM To: Darryl Hoar Cc: freebsd-questions@freebsd.org Subject: Re: OFF TOPIC - Shell Script Question On Tue, Feb 08, 2000 at 02:34:25PM -0600, 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 ? > Try $ for i in `ls -lt | grep 1999 | awk '{print $9}'` > do > mv $i /home/darryl/test > done $ > BTW, I don't plan on doing this a bunch, so I would preferr Not to > install, learn > perl. Instead, use the shell. > > thanks, > > Darryl Hoar > Computer Programmer / Systems Analyst > Osborne Industries, Inc. > darryl@osborne-ind.com > (785) 346-2192 > > PS. If perls the only ticket, then I'll install and learn it. > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- Microsoft: Where do you want to go today? Linux: Where do you want to go tomorrow? BSD: Are you guys coming, or what? -Poster at LinuxWorld 2000 ________________________________________________________________ FreeBSD - The Power To Serve http://www.freebsd.org My Webpage http://ukug.uk.freebsd.org/~mark/ mailto:mark@ukug.uk.freebsd.org http://www.radan.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message