command: find命令-exec参数的使用说明(转)
来源:互联网 发布:手机贴膜有必要吗 知乎 编辑:程序博客网 时间:2024/05/16 08:16
-exec command ;
Execute command; true if 0 status is returned. All following arguments to find are taken to be arguments to the command until an argument consisting of #;' is encountered. The string {}' is replaced by the current file name being processed everywhere it occurs in the arguments to the command, not just in arguments where it is alone, as in some versions of find. Both of these constructions might need to be escaped (with a /') or quoted to protect them from expansion by the shell. The command is executed in the starting directory.
其实只要读懂这段话就理解了,这里简单说明一下
-exec 参数后面跟的是 command命令,注意点如下:
command命令的终止,使用 ';' (分号)来判定,在后面必须有一个 ';'
'{}',使用{}来表示文件名,也就是find前面处理过程中过滤出来的文件,用于command命令进行处理
特别强调,对于不同的系统,直接使用分号可能会有不同的意义, 使用转义符 '/'在分号前明确说明。
举例:
1.查询所有包含字符串“Hello”的文件
find / -exec grep "Hello" {} /;
2.删除所有临时文件
find / -name "*.tmp" -exec rm -f {} /;
另外,上面这两条命令都可以用xargs来实现,比如:
1.find / | xargs grep "Hello"
2.find / -name "*.tmp" | xargs rm -f
- command: find命令-exec参数的使用说明
- command: find命令-exec参数的使用说明(转)
- linux find命令-exec参数的使用说明
- linux find命令-exec参数的使用说明 (转载)
- linux find命令-exec参数的使用说明(笔记)
- linux find命令-exec参数使用说明
- find 命令的 -exec 参数 -print
- Linux命令:find与exec参数的用法
- Linux命令:find与exec参数的用法
- Linux命令:find与exec参数的用法
- Linux命令:find与exec参数的用法
- find命令的exec参数使用---Linux学习笔记
- find: 遗漏“-exec”的参数
- find: 遗漏“-exec”的参数
- Linux find 命令 -exec 参数说明
- Linux命令:find与exec的用法
- Linux命令:find与exec的用法
- linux 命令 find -exec 操作的问题
- Android学习笔记之AndroidManifest.xml文件解析
- HDU 1021 Fibonacci Again
- android ListView详解
- 关于“在内联汇编中不能调用类的成员函数“的误解
- IA-32汇编知识
- command: find命令-exec参数的使用说明(转)
- 门户社区站内检索技术预研
- Dan Saks_const T vs T const
- ubuntu快捷键设置大全 [转]
- 陌上花开缓缓归(上平五微)
- Hibernate的查询 HQL查询
- 分页效果
- HDOJ 1698 Just a Hook
- 戴尔解决方案 帮助企业迎接“云”时代的到来