folksy 发表于 2013-1-31 02:15:36

linux 在文件开头插入文本

  在文件开头插入文本
  通过可在脚本中使用的 ed 单命令行程序,您可以容易地在文件开头插入文本。插入操作是使用 ed 并通过 a 命令将给定文本追加到第 0 行(文件开头)来完成的:
  $ cat file
  This is the end.
  $ (echo '0a'; echo 'This is the beginning.'; echo '.'; echo 'wq') | ed -s file
  $ cat file
  This is the beginning.
  This is the end.
页: [1]
查看完整版本: linux 在文件开头插入文本