rename using regexpr - is it possible?
Eliot Moss
moss@cs.umass.edu
Sun Oct 24 10:12:03 GMT 2021
On 10/24/2021 10:29 AM, Fergus Daly via Cygwin 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
More information about the Cygwin
mailing list