文章の間に4行追加[繰り返し]

文章の間に4行追加[繰り返し]

各文の間に4つの空白行を追加する簡単な方法はありますか?

たとえば、この段落は次のようになります。

This combination of vitamins and selected minerals is used to prevent or treat vitamin 
deficiency due to poor eating habits, problems that affect the body's ability to absorb nutrition from food, or increased need for vitamins and minerals due to stress 
or illness. Vitamins are needed for the body to function well.
This vitamin/mineral combination contains high levels of B vitamins (e.g., folic acid, 
niacin, B-1, B-2, B-6, and B-12) and vitamin C. It also contains other vitamins (A, D, and E) and minerals such as zinc. This medication does not contain iron and has only a 
small amount of calcium. Therefore, it should not be used to treat "iron-poor" blood 
(anemia) or to prevent osteoporosis.

どうすればいいですか?

This combination of vitamins and selected minerals is used to prevent or treat vitamin 




deficiency due to poor eating habits, problems that affect the body's ability to absorb nutrition from food, or increased need for vitamins and minerals due to stress 




or illness. Vitamins are needed for the body to function well.




This vitamin/mineral combination contains high levels of B vitamins (e.g., folic acid, 




niacin, B-1, B-2, B-6, and B-12) and vitamin C. It also contains other vitamins (A, D, and E) and minerals such as zinc. This medication does not contain iron and has only a 




small amount of calcium. Therefore, it should not be used to treat "iron-poor" blood 




(anemia) or to prevent osteoporosis.

私の考えでは:

1 - 各行の間に4つのスペースを追加します。

2 - 最初の行の後にスペースを追加してから、4つのスペースごとに追加します。

答え1

sedできる

sed 'G;G;G;G' file

説明する

答え2

sedコマンドを使用して実行しました。

sed "s/.*/&\n\n\n\n/g" filename

テストを経てうまく機能しました

関連情報