linux find -exec 用法
来源:互联网 发布:淘宝开店不知道卖什么 编辑:程序博客网 时间:2024/04/29 15:09
linux find -exec 用法
模式:
find <dir> -name <expression> -exec <command> {} \;
dir :检索路径
expression: 表达式(通用模式,不是正则表达式)
command: 二级命令
{} : 表示find 每检索出来一条的替代符号,(固定格式)
\; (固定格式)
另:{} \; 这两个固定格式之间是有空格的
如:
[user:public] find . -name test*.g* -exec ls -l {} \;
-rwxr-xr-x 1 user user 1441792 4月 29 23:37 ./lib_stream/simples/test.g711 #此时,{} 表示./lib_stream/simples/test.g711
-rw-r--r-- 1 user user 3331 4月 29 23:32 ./app_dev/test.gps
-rw-r--r-- 1 user user 1441792 4月 29 23:32 ./app_dev/test.g711
[user:public]
我们可以做一下变形:
func() { find . -name $1 -exec ls -l {} \; ; } ; func test*.g*
又如:
[user:public] func() { f $1 -exec ls -l {} \; ; } ; func test*.g*
-rwxr-xr-x 1 user user 1441792 4月 29 23:37 ./lib_stream/simples/test.g711
-rw-r--r-- 1 user user 3331 4月 29 23:32 ./app_dev/test.gps
-rw-r--r-- 1 user user 1441792 4月 29 23:32 ./app_dev/test.g711
[user:public]
好了.把它加到 ~/.bashrc 里做一个别名
alias fll='func() { find . -name $1 -exec ls -l {} \; ; } ; func '
如:
[user:public] fll test*.g*
-rwxr-xr-x 1 user user 1441792 4月 29 23:37 ./lib_stream/simples/test.g711
-rw-r--r-- 1 user user 3331 4月 29 23:32 ./app_dev/test.gps
-rw-r--r-- 1 user user 1441792 4月 29 23:32 ./app_dev/test.g711
[user:public]
command: 这个二级命令可以换成rm -rf 等. 也可以把检索出来文件名改名.
- linux find -exec 用法
- Linux命令:find与exec的用法
- Linux - find与exec的用法
- Linux命令:find与exec的用法
- linux下find用法 find -name *.so -exec ll {} \;
- Linux命令-find命令的exec选项用法详解
- Linux命令:find与exec参数的用法
- Linux命令:find与exec参数的用法
- Linux命令:find与exec参数的用法
- Linux命令:find与exec参数的用法
- linux find exec rm
- linux find exec rm
- Linux find 命令-exec
- Linux find -exec
- Linux find exec 记录
- find exec linux
- linux find exec
- linux find exec rm
- opencv中cvmat的通道学习
- 2013 duilib入门简明教程 -- 界面设计器 DuiDesigner (10)
- Unity与android开发——一款神奇的工具
- windows7 64位 mini2440开发板 USB驱动安装
- Unity 对运行顺序,整体架构的理解,初学
- linux find -exec 用法
- 内部类
- Unity基本知识点的掌握
- 2013 duilib入门简明教程 -- 部分bug (11)
- ZOJ Problem Set - 3702 Gibonacci number
- Github实例教程-创建库、创建主页
- 2013 duilib入门简明教程 -- 简单控件介绍 (12)
- Java 内部类种类及使用解析
- 微软的奥尔良项目简介