-----Original Message----- From: Eliot Moss <m...@cs.umass.edu> Sent: 24 October 2021 17:11 To: Fergus Daly <fergus...@outlook.com>; 'cygwin@cygwin.com' <cygwin@cygwin.com> Subject: Re: rename using regexpr - is it possible?
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 PS When I said .. .. > Perfect. Worked like a dream .. .. I had only tried things in Cygwin32. The cpan step failed in Cygwin64 so I couldn't follow up with the install File::Rename command. (I'm quite surprised. Here, the Cygwin32 and Cygwin64 setups are identical in that, whilst incomplete i.e. not "Full", they are constructed using the identical C:> setup -P {long list of packages separated by commas} command at the Windows prompt. Up to now they have behaved identically. Solved by copying across from Cygwin32 to Cygwin64 all the newly "rename-augmented" files under /usr/local/bin/, /usr/local/lib/, /usr/local/man/, and not forgetting the augmented file /etc/bash.bashrc containing the 4 export perl* lines. Seems to work so far. But if I hadn't also got Cygwin32, I would have been stuck with the cpan failure under Cygwin64. I must have missed something for Cygwin64 .. .. but Goodness knows what. -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple