将ACDC更换为AC-DC
例如,我们有这些文件
ACDC – Rock N’ Roll Ain’t Noise Pollution.xxx
ACDC – Rocker.xxx
ACDC – Shoot To Thrill.xxx
我希望他们成为:
AC-DC – Rock N’ Roll Ain’t Noise Pollution.xxx
AC-DC – Rocker.xxx
AC-DC – Shoot To Thrill.xxx
我知道sed或awk用于此操作.我不能谷歌任何东西,所以我要求你的帮助=)你能为这项任务提供完整的shell命令吗?
rename 's/ACDC/AC-DC/' *.xxx
从男人重命名
DESCRIPTION "rename" renames the filenames supplied according to the rule specified as the first argument. The perlexpr argument is a Perl expression which is expected to modify the $_ string in Perl for at least some of the filenames specified. If a given filename is not modified by the expression,it will not be renamed. If no filenames are given on the command line,filenames will be read via standard input.
例如,要重命名匹配“* .bak”的所有文件以剥离扩展名,您可能会说
rename 's/\.bak$//' *.bak
rename 'y/A-Z/a-z/' *