Linux Shell在文件的第一行插入字符串
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 |
1 | grep "include /etc/cinder/volumes/*" /etc/tgt/targets .conf || sed -i '1i include /etc/cinder/volumes/*' /etc/tgt/targets .conf |
*博客內(nèi)容為網(wǎng)友個(gè)人發(fā)布,僅代表博主個(gè)人觀點(diǎn),如有侵權(quán)請(qǐng)聯(lián)系工作人員刪除。