Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图弄清楚如何 grep 一个充满文件的文件夹,该文件夹包含每个文件的 3 个版本。它的原始版本和几个调整大小的版本。我想用 grep 删除所有名称中带有数字 0-9 或破折号的文件。
我可以简单地添加要查找的字符而不是(文件名)吗?
./delete -r (filename)
如果您使用的是 Linux,则可以使用 shell globbing 来实现此目的。
ls *[0-9-]*
如果这为您提供了所需的文件,您可以删除它们:
rm -i *[0-9-]*
-i如果有很多文件,请删除。
-i