當(dāng)前目錄下多個(gè)文件合并為一個(gè)文件
1、將多個(gè)文件合并為一個(gè)文件沒(méi)有添加換行符
find ./ -name "iptv_authenticate_201801*" | xargs cat > iptv_authenticate.txt
2、設(shè)置換行符^J
find ./ -name "iptv_authenticate_201801*" | xargs sed 'a/^J' > iptv_authenticate.txt
3、默認(rèn)換行符
find ./ -name "iptv_authenticate_201801*" | xargs sed 'a/' > iptv_authenticate.txtfind ./ -name "iptv_liveswitch_201801*" | xargs sed 'a/' > iptv_liveswitch.txtfind ./ -name "iptv_qualified_201801*" | xargs sed 'a/' > iptv_qualified.txtfind ./ -name "iptv_vodload_201801*" | xargs sed 'a/' > iptv_vodload.txt
當(dāng)前目錄下所有后綴為txt文件中追加一行數(shù)據(jù)作為文件內(nèi)容的第一行內(nèi)容
1、方法一
for fullpath in `find . -type f -name "*.txt"`do sed -i '1i/Num/tPhone/tDate/tMessage/tId/tGudge' ${fullpath}done備注:
-type f 是指后邊的查找文件類型為文件
2、方法二
find . -type f -name "*.txt" | xargs -I {} sed -i '1i/Num/tPhone/tDate/tMessage/tId/tGudge' {}總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)武林站長(zhǎng)站的支持。如果你想了解更多相關(guān)內(nèi)容請(qǐng)查看下面相關(guān)鏈接
新聞熱點(diǎn)
疑難解答
網(wǎng)友關(guān)注