Linux Shell在文件的第一行插入字符串
Linux Shell在文件的第一行插入字符串
我遇到的問題是在1000個 .txt 文件前增加 \x,
我的實現(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)友個人發(fā)布,僅代表博主個人觀點,如有侵權(quán)請聯(lián)系工作人員刪除。