LoginSignup
1
1

More than 1 year has passed since last update.

【Linux】sedで追加する文字列にスペースや改行をする方法

Last updated at Posted at 2022-11-27

スペースを追加する

追加する文字列にスペースを追加するには次のように実行します。

sed -i "/text/a \          追加するテキスト" sample.txt
sample.txt
text
          追加テキスト

改行を追加する

改行を追加するには次のように実行します。

sed -i "/text/a 追加するテキスト\n" sample.txt
sample.txt
text
追加するテキスト

          追加テキスト
1
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
1
1