From owner-freebsd-questions@FreeBSD.ORG Thu Dec 9 18:13:57 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 2FA3E16A4CE for ; Thu, 9 Dec 2004 18:13:57 +0000 (GMT) Received: from out2.smtp.messagingengine.com (out2.smtp.messagingengine.com [66.111.4.26]) by mx1.FreeBSD.org (Postfix) with ESMTP id B953643D5E for ; Thu, 9 Dec 2004 18:13:55 +0000 (GMT) (envelope-from nkinkade@fastmail.fm) Received: from frontend3.messagingengine.com (frontend3.internal [10.202.2.152]) by frontend1.messagingengine.com (Postfix) with ESMTP id 8EFBEC40807; Thu, 9 Dec 2004 13:13:54 -0500 (EST) X-Sasl-enc: tcxSYOTsc1Iahr+G1NXBaQ 1102616034 Received: from gentoo-npk.bmp.ub (unknown [206.27.244.136]) by www.fastmail.fm (Postfix) with ESMTP id 2B1C0247F3; Thu, 9 Dec 2004 13:13:54 -0500 (EST) Received: from nkinkade by gentoo-npk.bmp.ub with local (Exim 4.21) id 1CcSnI-000422-GB; Thu, 09 Dec 2004 12:13:36 -0600 Date: Thu, 9 Dec 2004 12:13:36 -0600 From: Nathan Kinkade To: antenneX Message-ID: <20041209181336.GA3650@gentoo-npk.bmp.ub> Mail-Followup-To: antenneX , freebsd-questions@freebsd.org References: <019101c4de0e$dbdeb2d0$0200000a@SAGEAME> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="O2g7+miYGsIKoR9l" Content-Disposition: inline In-Reply-To: <019101c4de0e$dbdeb2d0$0200000a@SAGEAME> User-Agent: Mutt/1.5.6i Sender: cc: freebsd-questions@freebsd.org Subject: Re: Find & Replace string X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Nathan Kinkade List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Dec 2004 18:13:57 -0000 --O2g7+miYGsIKoR9l Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 09, 2004 at 10:48:06AM -0600, antenneX wrote: > Help on commands/script needed. >=20 > In a website of 1.GB+ with several hundred thousand files, I need to > interrogate all files to replace a single string like "oldone.010" with > "newone.011" >=20 > What's the best way to do this? >=20 > Thanks in advance! >=20 > Best regards, >=20 > Jack L. Stone Are you talking about changing the name of the file itself, or a string within the file? If it's the former then a shell for loop work. Maybe something like: $ for file in $(find /somedir -name "*.010"); \ do mv $file $(echo $file | sed -e 's/oldone/newone'); \ done If the latter, then using perl, perhaps with the -e -i switches, might work well. man perlrun(1) for some tips. Nathan --O2g7+miYGsIKoR9l Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBuJXQO0ZIEthSfkkRArVxAJ996SUSenvWztB6wzwdhF0Y01R34QCg7Qw2 f4FvTNJIbL3v/0jrmHyj4aU= =dyjE -----END PGP SIGNATURE----- --O2g7+miYGsIKoR9l--