使用 grep / sed 进行文件名搜索和查找代替?
我有一堆图像文件被错误地命名为“[电子邮件受保护] ' 并且它们需要是“[电子邮件受保护]”。它们分布在多个目录中,如下所示:
/images
[email protected]
/icons
[email protected]
/backgrounds
[email protected]
How can I use grep + sed to find/replace as need?
I have a bunch of image files that were incorrectly named '[email protected]' and they need to be '[email protected]'. They're spread across multiple directories like so:
/images
[email protected]
/icons
[email protected]
/backgrounds
[email protected]
How can I use grep + sed to find/replace as needed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
红宝石(1.9+)
Ruby(1.9+)
查看 qmv 并重命名
将启动默认编辑器并允许您交互式地编辑名称
Look at qmv and rename
will launch your default editor and allow you to interactively edit the names
斜杠对我来说看起来像 linuxy/unixoid 。你有找到并重命名吗?
rename 值得安装,包含在一些 perl 软件包中。
Slashes look linuxy/unixoid to me. Do you have find and rename?
rename is worth installing, comes in some perl-package.
使用
bash 2.x/3.x
使用
bash 4.x
注意:
在每种情况下,我都留下了
echo
,以便您可以进行空运行,如果输出足够,请删除echo
With
bash 2.x/3.x
With
bash 4.x
Note:
In each case I left in an
echo
so you can do a dry-run, remove theecho
if the output is sufficient