在句子之间添加四行

在句子之间添加四行

有没有一种简单的方法可以在每个句子之间添加四个空行。

例如这一段:

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- 在每行之间添加四个空格。

2- 在第一行后添加一个空格,然后每四个空格添加

答案1

sed可以做到

sed 'G;G;G;G' file

解释

答案2

我已经使用 sed 命令通过以下方法完成了

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

测试并运行良好

相关内容