Linux Shell在文件的第一行插入字符串
Linux Shell在文件的第一行插入字符串
我遇到的问题是在1000个 .txt 文件前增加 \x,
我的实现: 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 |
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。