5
I just discovered zmv this morning.
To test it i have created a few files.
test1.txt test2.txt test3.txt
I'm trying to rename them with zmv I'd like to get this output:
test-1.txt test-2.txt test-3.txt
when I try to use wildcards I get an error message:
zmv '(*)([0-9]{1,})(.txt)' '$1-$2$3'
zmv: error: number of wildcards in each pattern must match
Am i doing something wrong (answer has to be yes :) )
@OliverSalzburg: It's not that it's greedy by default (backtracking takes care of what I think you're trying to fix). The problem is that
*
is applying to(
, since he wrote*
instead of.*
. That's probably why zmv thinks there aren't enough capturing groups. – Peter Cordes – 2015-03-01T09:45:31.943If the first parameter is a regular expression and it is greedy by default, try
([^0-9]*)
as the first part maybe. – Der Hochstapler – 2012-03-14T12:04:38.473What zsh version? Do you have
zmv
aliased? – Gilles 'SO- stop being evil' – 2012-03-14T22:38:57.213zsh 4.3.9, autoload -U zmv, alias zmv="noglob zmv -W" – Yannick Schall – 2012-03-14T23:26:24.470