获取 Perl 重命名实用程序而不是内置的重命名 [英] Get the Perl rename utility instead of the built-in rename
问题描述
许多站点(包括各种 SO 文章)都谈到使用 Perl 表达式使用重命名"来重命名文件.
Many sites (including various SO articles) talk about using "rename" using Perl expressions to rename files.
这将是完美的,但显然这不是我拥有的重命名实用程序,而且这些文章似乎都没有理解有多个版本的重命名",而且我似乎无法找到可以接受的版本Perl 表达式.
This would be perfect, but apparently this is not the rename utility I have, and none of these articles seem to comprehend that there are multiple versions of "rename" and I can't seem to find where to get version that accepts Perl expressions.
How can I get my hands on the more powerful rename utility mentioned here, here, and here?
我正在运行 Fedora 20.我当前的重命名命令来自 util-linux
包,显然我需要 Perl 版本,它更好.
I'm running Fedora 20. My current rename command is from the util-linux
package and apparently I need the Perl version, which is better.
推荐答案
我只能代表 Debian.这两个程序被称为
I can only speak for Debian. The two programs are called
/usr/bin/rename.ul
来自util-linux
包(因此是 .ul 后缀)/usr/bin/prename
来自perl
包
/usr/bin/rename.ul
from theutil-linux
package (hence the .ul suffix)/usr/bin/prename
from theperl
package
实际的 rename
命令通过 /etc/alternatives
机制工作,其中
The actual rename
command works via the /etc/alternatives
mechanism, whereby
/usr/bin/rename
是/etc/alternatives/rename
的符号链接/etc/alternatives/rename
是/usr/bin/prename
的符号链接
/usr/bin/rename
is a symlink to/etc/alternatives/rename
/etc/alternatives/rename
is a symlink to/usr/bin/prename
同样的问题在 Cygwin 上一直困扰着我,这是一个 Red Hat 产品,所以应该更类似于 Fedora.星期一我会看看我公司的笔记本电脑.我记得 Perl 重命名有时在那里工作过.可能在我安装 util-linux
之前.
The same problem has been bugging me on Cygwin, which is a Red Hat product, so should be more similar to Fedora. I'll have a look on my company laptop on Monday. And I remember the Perl-rename having worked there sometimes. Probably before I installed util-linux
.
如果您将 Perl-rename 安装到 /usr/local/bin
,它将优先于 util-linux
中的 rename
.安装到 /usr/local/share/man/man1/
时的联机帮助页也是如此.
If you install the Perl-rename to /usr/local/bin
it will have precedence over rename
from util-linux
. Same goes for the manpage when installed to /usr/local/share/man/man1/
.
我刚刚在 Github 上创建了一个单独的 Perl-rename 包:https://github.com/subogero/重命名
I've just created a separate Perl-rename package on Github: https://github.com/subogero/rename
这篇关于获取 Perl 重命名实用程序而不是内置的重命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!