Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
The solution is simple. When nesting repetition operators, make absolutely sure that there is only one way to match the same match.
perl -e 'foreach(glob("*")) { $o = $_; s/^(.+)\-\w+(\.\w+)$/\1\2/; rename($o, $_) or die("ERROR: can not rename $o to $_!\n"); }'