ITeye博客

linux 在文件开头添加内容

huiminchen · 2012-03-13 09:42 · Shell · linux · 编程语言 · Markdown

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。