rename using regexpr - is it possible?
Eliot Moss
moss@cs.umass.edu
Sun Oct 24 16:11:01 GMT 2021
On 10/24/2021 4:55 PM, Fergus Daly wrote:
>>> I might be wrong but:
>>> The Cygwin implementation of rename seems completely different from "the" (my) Linux version.
>>> (Almost unique? Otherwise the matching in Cygwin of all syntax -
>>> vocab, switches, outcomes - to Linux, seems almost perfect.)
>>> Can I rename a set of files *.d (say) as filename.d -> XXfilename.d?
>>> In Linux this would be achieved by
>>> $ rename 's/^/XX/g' ./*.d
>>> whereas in Cygwin
>>> $ rename ^ XX *.d
>>> (and all similar attempts) fails.
>>> Thank you.
>
>> You're confusing perl-rename with util-linu rename.
>> The former, which seems to be what you want, can be installed using cpan (install File::Rename),
>> assuming you have perl installed.
>> It will put its rename command in /usr/local/bin, presumably taking precedence over the util-linux one in /usr/bin.
>> It further seems that "normally" these two have different names, like rename.ul and prename,
>> and /etc/alternatives is used to set up the rename command.
>> This required some web searching to determine ...
>> Cheers - Eliot
>
> Perfect. Worked like a dream.
> All in place, and naming managed.
> Thanks so much.
No problem - learned something myself! EM
More information about the Cygwin
mailing list