我有一些名字有些相似的文件:
HappyBD_Stereo_144kbps.mp3
HappyBD_Stereo_192kbps.mp3
HappyBD_Stereo_256kbps.mp3
...
出于某种原因,我需要将这些名称更改/缩短为
HappyBD_Ste_144k.mp3
HappyBD_Ste_192k.mp3
HappyBD_Ste_256k.mp3
...
有人可以推荐一种自动更改此类文件名的好方法吗?感谢。
答案 0 :(得分:1)
你可以尝试,
for filename in `ls *_Stereo_*.mp3`; do
newfilename=$(sed 's/_Stereo_/_Ste_/g' <<< $filename);
mv $filename $newfilename;
done