[root@k8s-master test2]# cat test2.txt
HELLOWORLD
THIS IS A TEST
EOF TEST!
[root@k8s-master test2]# cat test2.txt | xargs -I {} echo start {} end
start HELLOWORLD end
start THIS IS A TEST end
start EOF TEST! end
[root@k8s-master test2]#
[root@k8s-master test2]# find . -type f -name '*.txt' -print0
./test1.txt./test2.txt[root@k8s-master test2]# find . -type f -name '*.txt' -print
./test1.txt
./test2.txt
[root@k8s-master test2]# clear
[root@k8s-master test2]# find . -type f -name '*.txt' -print0 | xargs -0 wc -l
1 ./test1.txt
3 ./test2.txt
4 总用量
[root@k8s-master test2]# cat test2.txt
HELLOWORLD
THIS IS A TEST
EOF TEST!
[root@k8s-master test2]# cat test2.txt | xargs
HELLOWORLD THIS IS A TEST EOF TEST!
[root@k8s-master test2]# cat test2.txt | xargs -n2
HELLOWORLD THIS
IS A
TEST EOF
TEST!
[root@k8s-master test2]# cat test2.txt | xargs -n3
HELLOWORLD THIS IS
A TEST EOF
TEST!
[root@k8s-master test2]#
[root@k8s-master test2]# echo 'abc;def;mmm;' | xargs -d';'
abc def mmm
[root@k8s-master test2]# echo 'abc;def;mmm;' | xargs -d';' -n2
abc def
mmm
[root@k8s-master test2]#