From owner-freebsd-questions Wed Feb 9 1: 8:29 2000 Delivered-To: freebsd-questions@freebsd.org Received: from web2.sea.nwserv.com (web2.sea.nwserv.com [216.145.16.2]) by builder.freebsd.org (Postfix) with ESMTP id 3FD854418 for ; Tue, 8 Feb 2000 23:10:15 -0800 (PST) Received: from localhost (dpk@localhost) by web2.sea.nwserv.com (8.9.3/8.9.3) with ESMTP id XAA48454; Tue, 8 Feb 2000 23:09:28 -0800 (PST) (envelope-from dpk@nwserv.com) Date: Tue, 8 Feb 2000 23:09:28 -0800 (PST) From: David Kirchner X-Sender: dpk@web2.sea.nwserv.com To: Darryl Hoar Cc: freebsd-questions@FreeBSD.ORG Subject: Re: OFF TOPIC - Shell Script Question In-Reply-To: <001101bf7273$e44dc250$070101c0@ruraltel.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 8 Feb 2000, 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 ? You can run the output of your command through sh: ls -tl | ... | ... > file sh file or ls -tl | ... | ... | sh If you want to see some verbose output, change 'sh' to 'sh -x'. There are a couple more ways you can perform the same command to multiple files. Check out 'find' and its -exec flag. -- David Kirchner - dpk@nwserv.com Northwest Web Services - http://www.nwserv.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message