linux 在资料开头添加内容
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