熱搜:win11繞過硬件限制安裝 一鍵重裝Win10系統(tǒng) 最干凈的u盤啟動盤 真正純凈版的win7系統(tǒng)
時間:2014-12-31 17:57:43 作者:qipeng 來源:系統(tǒng)之家 1. 掃描二維碼隨時看資訊 2. 請使用手機瀏覽器訪問: https://m.xitongzhijia.net/xtjc/20141231/33885.html 手機查看 評論 反饋
實例6:使用xargs執(zhí)行mv
命令:
代碼如下:
find 。 -name “*.log” | xargs -i mv {} test4
輸出:
代碼如下:
。踨oot@localhost test]# ll
總計 316
-rw-r--r-- 1 root root 302108 11-03 06:19 log2012.log
-rw-r--r-- 1 root root 61 11-12 22:44 log2013.log
-rw-r--r-- 1 root root 0 11-12 22:25 log2014.log
drwxr-xr-x 6 root root 4096 10-27 01:58 scf
drwxrwxr-x 2 root root 4096 11-12 22:54 test3
drwxrwxr-x 2 root root 4096 11-12 19:32 test4
。踨oot@localhost test]# cd test4/
。踨oot@localhost test4]# ll
總計 0[root@localhost test4]# cd 。。
[root@localhost test]# find 。 -name “*.log” | xargs -i mv {} test4
。踨oot@localhost test]# ll
總計 12drwxr-xr-x 6 root root 4096 10-27 01:58 scf
drwxrwxr-x 2 root root 4096 11-13 05:50 test3
drwxrwxr-x 2 root root 4096 11-13 05:50 test4
。踨oot@localhost test]# cd test4/
。踨oot@localhost test4]# ll
總計 304
-rw-r--r-- 1 root root 302108 11-12 22:54 log2012.log
-rw-r--r-- 1 root root 61 11-12 22:54 log2013.log
-rw-r--r-- 1 root root 0 11-12 22:54 log2014.log
[root@localhost test4]#
實例7:find后執(zhí)行xargs提示xargs: argument line too long解決方法:
命令:
代碼如下:
find 。 -type f -atime +0 -print0 | xargs -0 -l1 -t rm -f
輸出:
代碼如下:
。踨oot@pd test4]# find 。 -type f -atime +0 -print0 | xargs -0 -l1 -t rm -f
rm -f
。踨oot@pdtest4]#
說明:
-l1是一次處理一個;-t是處理之前打印出命令
實例8:使用-i參數(shù)默認(rèn)的前面輸出用{}代替,-I參數(shù)可以指定其他代替字符,如例子中的[]
命令:
輸出:
代碼如下:
。踨oot@localhost test]# ll
總計 12drwxr-xr-x 6 root root 4096 10-27 01:58 scf
drwxrwxr-x 2 root root 4096 11-13 05:50 test3
drwxrwxr-x 2 root root 4096 11-13 05:50 test4
。踨oot@localhost test]# cd test4
。踨oot@localhost test4]# find 。 -name “file” | xargs -I [] cp [] 。。
。踨oot@localhost test4]# ll
總計 304
-rw-r--r-- 1 root root 302108 11-12 22:54 log2012.log
-rw-r--r-- 1 root root 61 11-12 22:54 log2013.log
-rw-r--r-- 1 root root 0 11-12 22:54 log2014.log
。踨oot@localhost test4]# cd 。。
。踨oot@localhost test]# ll
總計 316
-rw-r--r-- 1 root root 302108 11-13 06:03 log2012.log
-rw-r--r-- 1 root root 61 11-13 06:03 log2013.log
-rw-r--r-- 1 root root 0 11-13 06:03 log2014.log
drwxr-xr-x 6 root root 4096 10-27 01:58 scf
drwxrwxr-x 2 root root 4096 11-13 05:50 test3
drwxrwxr-x 2 root root 4096 11-13 05:50 test4
[root@localhost test]#
發(fā)表評論
共0條
評論就這些咯,讓大家也知道你的獨特見解
立即評論以上留言僅代表用戶個人觀點,不代表系統(tǒng)之家立場