日期:2014-05-16  浏览次数:20564 次

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