From owner-freebsd-questions Wed Jan 8 8:20:27 2003 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 B237837B401 for ; Wed, 8 Jan 2003 08:20:25 -0800 (PST) Received: from void.xpert.com (smtp.xpert.com [199.203.132.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id B5ABF43EB2 for ; Wed, 8 Jan 2003 08:20:23 -0800 (PST) (envelope-from Yonatan@xpert.com) Received: from exchange.xpert.com ([199.203.132.135]) by void.xpert.com with esmtp (Exim 3.22 #1) id 18WIss-0004HE-00 for freebsd-questions@freebsd.org; Wed, 08 Jan 2003 18:16:50 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Renaming files with spaces in the name to files without spaces.. Date: Wed, 8 Jan 2003 18:17:26 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Renaming files with spaces in the name to files without spaces.. Thread-Index: AcK3LuuX3uZXiCY/Rg+WyTfyg7xCOAAAfjxQ From: "Yonatan Bokovza" To: Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > -----Original Message----- > From: BigBrother (BigB3) [mailto:bigbrother@bonbon.net] > Sent: Wednesday, January 08, 2003 18:02 > To: freebsd-questions@freebsd.org > Subject: Renaming files with spaces in the name to files=20 > without spaces.. >=20 >=20 > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 >=20 >=20 > Sorry for this OT but I am trying for some hours to achieve a massive > rename of files using a simple script and I have not success=20 > yet. I want > to rename files like >=20 > "RESULTS OF JAN 01 2002.txt " >=20 > to >=20 > "RESULTS_OF_JAN_01_2002.txt" your input | sed "s/ *$// s/ /_/g" The first line means 'remove all spaces before the end of the line', the second mean 'change all spaces to underscores', and if you don't close the quotes, sed will run this one after the other. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message