Date: Wed, 9 Feb 2000 00:47:01 -0500 From: "Crist J. Clark" <cjc@cc942873-a.ewndsr1.nj.home.com> To: "James A. Mutter" <jmutter@ds.net> 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> In-Reply-To: <38A0828F.6E5E703C@ds.net>; from jmutter@ds.net on Tue, Feb 08, 2000 at 03:54:39PM -0500 References: <001101bf7273$e44dc250$070101c0@ruraltel.net> <38A0828F.6E5E703C@ds.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000209004700.B64938>
