rename
ファイル一括リネーム
rename aaa_ bbb_ *.txt
rename <before> <after> <target file(s)>
例(util-linux / BSD rename)
$ touch aaa_{1..3}.txt
$ rename aaa_ bbb_ *.txt
$ ls -1
bbb_1.txt
bbb_2.txt
bbb_3.txt
$
Perl 版 rename もあり、rename 's/old/new/' *.txt で正規表現による置換ができる。
dnf provides rename(パッケージ確認)
util-linuxに入ってる。
Repo : @System
Matched from:
Filename : /usr/bin/rename
util-linux-2.37.4-21.el9.x86_64 : A collection of basic system
: utilities
Repo : baseos
Matched from:
Filename : /usr/bin/rename
$
環境
$ cat /etc/redhat-release
AlmaLinux release 9.7 (Moss Jungle Cat)
$