中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. "); //-->

        博客專欄

        EEPW首頁 > 博客 > Linux Shell在文件的第一行插入字符串

        Linux Shell在文件的第一行插入字符串

        發(fā)布人:電子禪石 時(shí)間:2021-04-27 來源:工程師 發(fā)布文章

        Linux Shell在文件的第一行插入字符串


        我遇到的問題是在1000個(gè) .txt 文件前增加 \x, 

        我的實(shí)現(xiàn): sed -i ‘1i \\\x' your.txt

        原先比較愚蠢的做法:

        1
        grep  "include /etc/cinder/volumes/*"  /etc/tgt/targets .conf ||  echo  'include /etc/cinder/volumes/*'  |  cat  -  /etc/tgt/targets .conf >  /etc/tgt/targets .conf

        后來,直接用sed處理:

        1
        grep  "include /etc/cinder/volumes/*"  /etc/tgt/targets .conf ||  sed  -i  '1i include /etc/cinder/volumes/*'  /etc/tgt/targets .conf
        1. 其中i表示插入,而且是添加到當(dāng)前行的上一行;而a是添加到當(dāng)前行的后一行。

        2. 注意:在sed中沒有第0行之說。


        *博客內(nèi)容為網(wǎng)友個(gè)人發(fā)布,僅代表博主個(gè)人觀點(diǎn),如有侵權(quán)請(qǐng)聯(lián)系工作人員刪除。



        關(guān)鍵詞: shell

        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉