From owner-freebsd-questions@FreeBSD.ORG Thu Apr 8 09:37:11 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 935E516A4CE for ; Thu, 8 Apr 2004 09:37:11 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (ns0.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id D0B3943D49 for ; Thu, 8 Apr 2004 09:37:10 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) i38GaxBj026746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Apr 2004 17:36:59 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost)id i38GaxYL026745; Thu, 8 Apr 2004 17:36:59 +0100 (BST) (envelope-from matthew) Date: Thu, 8 Apr 2004 17:36:59 +0100 From: Matthew Seaman To: Peter Risdon Message-ID: <20040408163658.GC26470@happy-idiot-talk.infracaninophile.co.uk> Mail-Followup-To: Matthew Seaman , Peter Risdon , FreeBSD Question List References: <40757879.1010307@circlesquared.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="i7F3eY7HS/tUJxUd" Content-Disposition: inline In-Reply-To: <40757879.1010307@circlesquared.com> User-Agent: Mutt/1.5.6i X-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on happy-idiot-talk.infracaninophile.co.uk X-Virus-Scanned: clamd / ClamAV version devel-20040323, clamav-milter version 0.70a cc: FreeBSD Question List Subject: Re: Pipes and commands that require two arguments X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2004 16:37:11 -0000 --i7F3eY7HS/tUJxUd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 08, 2004 at 05:06:17PM +0100, Peter Risdon wrote: > I want to redirect the output of a command to mv(1) as the source file,= =20 > and specify somehow a destination directory. Basically, I have to move=20 > several thousand files whose names match a number of patterns to a=20 > single directory. >=20 > Any suggestions will be gratefully received. There's several ways of doing this. Assuming you've got a command "listfiles" which returns the list of files you want moved from the current directory: % mv `listfiles` /destination/directory/ If the number of files to move is larger than the maximum number of command linearguments: #!/bin/sh for f in `listfiles` ; do mv $f /destination/directory/ done or you can use xargs(1): listfiles | xargs -J % mv % /destination/directory/ Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --i7F3eY7HS/tUJxUd Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAdX+qdtESqEQa7a0RAjGlAJ43F4X1kk3W2EXaJenQ7/9txQ0WiQCffCrB uAWOr0H+FV6l67VR8GQmXOo= =3cLf -----END PGP SIGNATURE----- --i7F3eY7HS/tUJxUd--