Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jan 2003 18:17:26 +0200
From:      "Yonatan Bokovza" <Yonatan@xpert.com>
To:        <freebsd-questions@freebsd.org>
Subject:   RE: Renaming files with spaces in the name to files without spaces..
Message-ID:  <C2DC75EEA405354AA9C03EF5CB8CDE080B6854@EXCHANGE.xpert.com>

next in thread | raw e-mail | index | archive | help
> -----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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C2DC75EEA405354AA9C03EF5CB8CDE080B6854>