几个常用的xargs使用例子
2012-09-28 18:23
316 查看
xargs是一个非常有用的命令。下面给出我常用的几个例子:
假设有文件 f 内容如下:
test命令把命令行输入原样输出,源码如下:
假设有文件 f 内容如下:
abc 123 456 789 qwe rty op
test命令把命令行输入原样输出,源码如下:
#include <stdio.h> int main(int argc, char **argv) { for(int i=0; i<argc; ++i) printf("%s ", argv[i]); printf("\n"); return 0; }
cat f|xargs ./test 输出: ./test abc 123 456 789 qwe rty op cat f|xargs -n 1 ./test 输出: ./test abc ./test 123 ./test 456 ./test 789 ./test qwe ./test rty ./test op cat f|xargs -n 1 ./test xxx 输出: ./test xxx abc ./test xxx 123 ./test xxx 456 ./test xxx 789 ./test xxx qwe ./test xxx rty ./test xxx op cat f|xargs -I aaa -n 1 ./test aaa xxx 输出: ./test abc xxx ./test 123 xxx ./test 456 xxx ./test 789 xxx ./test qwe xxx ./test rty xxx ./test op xxx cat f|xargs -i -n 1 ./test {} xxx 输出: ./test abc xxx ./test 123 xxx ./test 456 xxx ./test 789 xxx ./test qwe xxx ./test rty xxx ./test op xxx
相关文章推荐
- 总结了几个常用的sql server系统表的使用[转]
- CentOS下使用rpm 几个常用命令
- 常用的几个字符串函数的使用和实现
- cocos2d-x-2.0新增加了几个UI控件,这里我介绍下常用的这几个UI控件(CCControlSlider、CCControlSwitch、CCControlColourPicker)使用方法
- HttpClient 4使用方法的几个例子
- Linux (Ubuntu) 使用过程中常用的几个指令和工具
- 几个常用监控工具的使用
- HttpClient 4使用方法的几个例子
- 几个常用的集合类的使用
- 在SQL Server 的使用过程中,发现几个很有用,但不太常用
- android之Uri的常用几个例子
- Python random模块(获取随机数)常用方法和使用例子
- 正则表达式基础知识及常用表单验证正则(使用时查找为主,需多加基础方法的例子)
- 常用的几个MyEclipse使用技巧
- Perl常用模块使用例子
- 使用到的Linux的几个常用命令(1)
- perl 常用模块使用例子
- 使用crontab的几个例子.
- 使用Jakarta-ORO库的几个例子
- android Uri的常用几个例子