LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 867|回复: 1

用find命令对找到的文件进行改名操作

[复制链接]
发表于 2006-3-16 18:19:59 | 显示全部楼层 |阅读模式
将当前目录下类似于lu7这样的文件改名为lu_7:

  1. find ./ -name "*[a-z][1-9]*" -print -ok mv {} $(echo {} | sed 's/\(.*[a-z]\)\([1-9].*\)/\1_\2/g') \;
复制代码

为什么上述命令不起作用呢?
echo filename | sed 's/\(.*[a-z]\)\([1-9].*\)/\1_\2/g'
部分我单独测试了,好使啊
发表于 2006-3-17 02:13:55 | 显示全部楼层
ya.. with | and without | are the same result, so maybe this cmd is not accepting pipeline. try pipe it to while loop and process from there.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表