Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Dec 2014 10:34:57 -0800
From:      Jungle Boogie <jungleboogie0@gmail.com>
To:        "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Perl rename utility assistance
Message-ID:  <54907B51.1060807@gmail.com>

next in thread | raw e-mail | index | archive | help
Hello All,

I figure I would try my luck here with this question. Usually I go to 
stackoverflow for these things so pardon the noise if you're not accustom to 
seeing letters like this.

Objective: remove an underscore from a filename using rename[0].
Example: 8213_freebsd_is_cool_Nov_2014.pdf

I only want to remove the underscore (_) between the 3 and f to make it:
8213 freebsd_is_cool_Nov_2014.pdf
or
8213 _freebsd_is_cool_Nov_2014.pdf

rename '-sr/^([:digit:]_) /^[:digit:] /g' *
rename '-s/^[:digit:]_/^[:digit:] /g' *
rename '-sr/^[:digit:]_/^[:digit:] /g' *

Doesn't return any errors but the files don't get updated either.

man page:
  	rename -s/^[A-Z].*file/nofile/r *
The target substring starts with a capital letter, and ends with
string 'file'. There are 0 or any numbers of characters between
the capital letter and 'file'. The substring, if encountered in
filenames, will be replaced with 'nofile'.


How is this supposed to actually work?

[0] https://www.freshports.org/sysutils/rename/
-- 
inum: 883510009027723
sip: jungleboogie@sip2sip.info
xmpp: jungle-boogie@jit.si



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