From: "Alok K. Dhir" <adhir@symplicity.com>
To: Scott Taylor <scott@dctchambers.com>
Cc: linux-admin@vger.kernel.org
Subject: Re: Stupid spaces
Date: Thu, 12 Feb 2004 16:23:16 -0500 [thread overview]
Message-ID: <402BEEC4.8080605@symplicity.com> (raw)
In-Reply-To: <5.2.1.1.0.20040212130333.00b0f4a0@mustang>
[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]
The attached rename.pl is invaluable for such tasks.
Use it exactly like your bash rename attempt. You can use pretty much
any perl in-place-modifier construct - s/X/Y/, tr/A-Z/a-z/
(upper->lower), etc.
Not sure where I found this originally, but it's extremely handy.
Al
Scott Taylor wrote:
> Hello all,
>
> I've done this before, but so long ago I can't find it again. I have
> a bunch of files with spaces in them and I want to rename them with
> the spaces removed.
>
> I have a rename command that came with RH7.2 but doesn't do the job
> rename 's/\ //g' *
> does nothing in bash
>
> So I wrote a script many moons ago to do this but I can't remember
> which server it was on, let alone how I did it. Something with tr and
> mv methinks.
>
> anyone?
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Alok K. Dhir <adhir@symplicity.com>
Symplicity Corporation
http://solutions.symplicity.com
703 351 6987 (w) | 703 351-6357 (f)
[-- Attachment #2: rename.pl --]
[-- Type: text/plain, Size: 226 bytes --]
#!/usr/bin/perl
if (@ARGV == 0) {
die "usage: rename PATTERN FILESPEC\n";
}
$pattern=shift;
foreach (@ARGV) {
my $oldname=$_;
my $newname=$_;
eval ("\$newname=~$pattern");
rename($oldname, $newname);
}
next prev parent reply other threads:[~2004-02-12 21:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-12 21:08 Stupid spaces Scott Taylor
2004-02-12 21:23 ` Alok K. Dhir [this message]
2004-02-12 22:19 ` Scott Taylor
2004-02-12 21:39 ` Yu Chen
2004-02-12 22:18 ` Scott Taylor
2004-02-13 2:15 ` rich+ml
2004-02-13 4:07 ` Emiliano Castagnari
2004-02-13 16:56 ` Scott Taylor
2004-02-13 6:51 ` Agus Budy Wuysang
2004-02-13 17:15 ` Scott Taylor
[not found] ` <Pine.LNX.4.44.0402121811240.3031-100000@deadrat.localdomai n>
2004-02-13 16:33 ` Scott Taylor
2004-02-13 17:26 ` rich+ml
[not found] ` <Pine.LNX.4.44.0402130907370.3031-100000@deadrat.localdomai n>
2004-02-13 17:33 ` Scott Taylor
-- strict thread matches above, loose matches on Subject: below --
2004-02-13 19:13 urgrue
2004-07-19 13:29 calin
2004-07-19 13:56 ` Chris DiTrani
2004-07-19 14:59 ` calin
2004-07-19 14:45 ` Scott Taylor
2004-07-19 14:52 ` Scott Taylor
2004-07-20 17:48 ` scohen
2004-07-20 18:22 ` Adam Lang
2004-07-20 17:55 ` scohen
2004-07-20 18:20 ` Chris DiTrani
2004-07-20 18:37 ` Adam Lang
2004-07-21 2:28 ` Glynn Clements
2004-07-21 7:11 ` calin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=402BEEC4.8080605@symplicity.com \
--to=adhir@symplicity.com \
--cc=linux-admin@vger.kernel.org \
--cc=scott@dctchambers.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).