On Sat, Feb 24, 2018 at 5:40 PM, Wolfgang Pfeiffer <roto(a)gmx.net> wrote:
On Sat, 24 Feb 2018 13:14:49 -0500
Tom H <tomh0665(a)gmail.com> wrote:
> On Sat, Feb 24, 2018 at 9:03 AM, bruce <badouglas(a)gmail.com> wrote:
>>
>> Have a bunch of files with the basic naming of:
>> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
>> ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
>> etc..
>>
>> I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
>> files, renaming the files to the rest of the filename..
>>
>> Thought it should be simple using rename
>>
>> rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
>>
>> However, this didn't work... so.. hmm..
>
> Is "rename" provided by util-linux or is it a perl-provided script?
>
> The util-linux syntax is
>
> rename search_for replace_with <files>
>
> while the perl-script syntax is
>
> rename 's/search_for/replace_with/' <files>
thanks for the latter sed syntax - good to know on Debian, IINM ...
You're welcome.
The perl syntax isn't Debian-specific; I've used it on Fedora or RHEL
but I can't remember whether it'd been installed with yum (and what
the package might've been) or installed independently of the packaging
system.
On Debian, util-linux is installed by default. It brings in
"rename.ul" and the alternatives system's used to create a
"rename"
symlink to it. If you then install "rename", it brings in
"file-rename" and the alternatives system is used to switch the
"rename" symlink to it.
Different strokes for different distros...