5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Mac の sed でファイルの先頭に文字列を挿入する

Last updated at Posted at 2020-07-01

Mac の sed(BSD sed)でファイルの先頭に文字列(行)を挿入する

注:ファイルを上書きします

$ sed -i '' -e $'1s/^/挿入する文字列\\\n/' ファイル

ググり方が悪いのか、Linux の GNU sed の情報ばかりで一発で出てこなかったので。

関連記事

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?