linux 在文件开头添加内容
1、利用ed命令
例如:
(echo '0a'; echo 'This is the beginning.'; echo '.'; echo 'wq') | ed -s file
?
2、利用sed命令
?
sed -i '1i\This is the beginning' file
发布时间: 2012-12-27 10:17:10 作者: rapoo
linux 在文件开头添加内容
1、利用ed命令
例如:
(echo '0a'; echo 'This is the beginning.'; echo '.'; echo 'wq') | ed -s file
?
2、利用sed命令
?
sed -i '1i\This is the beginning' file