linux - Bash 脚本 : How do I rename files to remove numeric characters at the beginning?

标签 linux command-line pattern-matching gnu

mv 命令不像 grep 那样接受模式匹配!
处理这种操作和类似操作的好方法是什么?

最佳答案

重命名工具,但如果这不是您想要的,您可以这样做:

for file in *; do
    new_file="${file##[0-9]}" # Strip all leading numbers
    mv "$file" "$newfile"
done

关于linux - Bash 脚本 : How do I rename files to remove numeric characters at the beginning?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3064089/

相关文章:

awk - 列的行太长错误

scala - 无法用作模式中的提取器,因为它缺少 unapply 或 unapplySeq 方法

python - 如何检查另一个字符串中是否存在确切的字符串?

python - 皮查姆Linux。如何在 Project Inspetor 中更改所选文件的配色方案

c++ - 获取linux输入设备

mysql - 使用 MySQL 更新 20,000 行具有相同值

sed 在多行模式之前插入多行

linux - STDIN_FILENO 和 STDOUT_FILENO 的非阻塞 I/O 行为很奇怪

linux - 通讯命令 - 不必要的限制?

command-line - 用于更改AssemblyName的项目级别而不是解决方案级别的Msbuild命令行参数