首页 > 系统服务 > 详细

【Linux】参数传递之xargs

时间:2021-08-25 23:31:09      阅读:17      评论:0      收藏:0      [点我收藏+]

1.xargs命令可以使用-I选项指定一个替换字符串,xargs会用读取到的参数替换掉这个替换字符串。

:~/work/test$ ls *.txt | xargs -I{} cp {} /tmp/
:~/work/test$ ls *.txt | xargs -I{} ls {}
1.txt
2.txt
3.txt

2.xargs命令可以通过-d选项指定任意字符为分隔符,默认以空格、Tab制表符或换行符为分隔符。

:~/work/test$ echo "hellotheworld" | xargs
hellotheworld
:~/work/test$ echo "hello the world" | xargs
hello the world
:~/work/test$ echo "helloatheaworld" | xargs -da
hello the world

【Linux】参数传递之xargs

原文:https://www.cnblogs.com/wucaiyun1/p/15186763.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!