Suppose I have a file abc.csv with below data:
abc
def
geh
ijk
lmn
opq
rst
Now, I want to insert blank lines after line2 and line 6.
Please suggest which command shall I use.
sed
Suppose I have a file abc.csv with below data:
abc
def
geh
ijk
lmn
opq
rst
Now, I want to insert blank lines after line2 and line 6.
Please suggest which command shall I use.
Best Answer
The
G
sed
command appends a newline followed by the content of the hold space (here empty as we don't put anything in it) to the pattern space. So it's a quick way to add an empty line below that matched line.Other alternatives are the
a
ands
command:Or:
Some
sed
implementation also support: