public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* rename using regexpr - is it possible?
@ 2021-10-24  9:29 Fergus Daly
  2021-10-24 10:12 ` Eliot Moss
  0 siblings, 1 reply; 8+ messages in thread
From: Fergus Daly @ 2021-10-24  9:29 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: rename using regexpr - is it possible?
  2021-10-24  9:29 rename using regexpr - is it possible? Fergus Daly
@ 2021-10-24 10:12 ` Eliot Moss
  2021-10-24 10:15   ` Eliot Moss
  2021-10-24 15:55   ` Fergus Daly
  0 siblings, 2 replies; 8+ messages in thread
From: Eliot Moss @ 2021-10-24 10:12 UTC (permalink / raw)
  To: Fergus Daly, 'cygwin@cygwin.com'

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: rename using regexpr - is it possible?
  2021-10-24 10:12 ` Eliot Moss
@ 2021-10-24 10:15   ` Eliot Moss
  2021-10-24 15:55   ` Fergus Daly
  1 sibling, 0 replies; 8+ messages in thread
From: Eliot Moss @ 2021-10-24 10:15 UTC (permalink / raw)
  To: Fergus Daly, 'cygwin@cygwin.com'

I meant: util-linux ...

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: rename using regexpr - is it possible?
  2021-10-24 10:12 ` Eliot Moss
  2021-10-24 10:15   ` Eliot Moss
@ 2021-10-24 15:55   ` Fergus Daly
  2021-10-24 16:11     ` Eliot Moss
  1 sibling, 1 reply; 8+ messages in thread
From: Fergus Daly @ 2021-10-24 15:55 UTC (permalink / raw)
  To: moss, 'cygwin@cygwin.com'; +Cc: Fergus Daly

>> 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.
Fergus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: rename using regexpr - is it possible?
  2021-10-24 15:55   ` Fergus Daly
@ 2021-10-24 16:11     ` Eliot Moss
  2021-10-25 20:29       ` Fergus Daly
  0 siblings, 1 reply; 8+ messages in thread
From: Eliot Moss @ 2021-10-24 16:11 UTC (permalink / raw)
  To: Fergus Daly, 'cygwin@cygwin.com'

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: rename using regexpr - is it possible?
  2021-10-24 16:11     ` Eliot Moss
@ 2021-10-25 20:29       ` Fergus Daly
  2021-10-26  8:29         ` Eliot Moss
  0 siblings, 1 reply; 8+ messages in thread
From: Fergus Daly @ 2021-10-25 20:29 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

-----Original Message-----
From: Eliot Moss <moss@cs.umass.edu> 
Sent: 24 October 2021 17:11
To: Fergus Daly <fergusd84@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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: rename using regexpr - is it possible?
  2021-10-25 20:29       ` Fergus Daly
@ 2021-10-26  8:29         ` Eliot Moss
  2021-10-26  9:38           ` Fergus Daly
  0 siblings, 1 reply; 8+ messages in thread
From: Eliot Moss @ 2021-10-26  8:29 UTC (permalink / raw)
  To: Fergus Daly, 'cygwin@cygwin.com'

Turns out that my installation that I reported about was for cygwin64.
Given your mail, I tried cygwin32 also (I happen to have both installed,
mostly laziness) and the installation went fine for me there, too.  So,
yes, must be something about what you had (not) installed, but you're
right that now it is hard to tell what is was ...

Best - Eliot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: rename using regexpr - is it possible?
  2021-10-26  8:29         ` Eliot Moss
@ 2021-10-26  9:38           ` Fergus Daly
  0 siblings, 0 replies; 8+ messages in thread
From: Fergus Daly @ 2021-10-26  9:38 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'; +Cc: Fergus Daly, moss

Trivial glitch, indpt of cpan.
Now sorted on both 32 and 64.
Thanks again for all.
(Like you I keep 32 running and uptodate, disregarding dire warnings.
Why? Partly laziness, partly anxiety at loss after so many years' honing.
Also, specifically: it supports wish outside XWin. In 64, Xwin has to be up and running.
Don't like that.) 

-----Original Message-----
From: Eliot Moss <moss@cs.umass.edu> 
Sent: 26 October 2021 09:29
To: Fergus Daly <fergusd84@outlook.com>; 'cygwin@cygwin.com' <cygwin@cygwin.com>
Subject: Re: rename using regexpr - is it possible?

Turns out that my installation that I reported about was for cygwin64.
Given your mail, I tried cygwin32 also (I happen to have both installed, mostly laziness) and the installation went fine for me there, too.  So, yes, must be something about what you had (not) installed, but you're right that now it is hard to tell what is was ...

Best - Eliot

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-10-26  9:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-24  9:29 rename using regexpr - is it possible? Fergus Daly
2021-10-24 10:12 ` Eliot Moss
2021-10-24 10:15   ` Eliot Moss
2021-10-24 15:55   ` Fergus Daly
2021-10-24 16:11     ` Eliot Moss
2021-10-25 20:29       ` Fergus Daly
2021-10-26  8:29         ` Eliot Moss
2021-10-26  9:38           ` Fergus Daly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).