Skip to main content
4 of 4
deleted 72 characters in body
Porcupine
  • 2.2k
  • 4
  • 26
  • 60

Sed delete empty lines after a particular line number

I am trying to delete all empty lines after line number 3, till the end of the file:

cat ${File}
1

2
3


4

5

5



6
7



8
9


sed -e '3,${s~^$~~g}' ${File}
1

2
3


4

5

5



6
7



8
9

Observation: No change in the output.

Desired Output

1

2
3
4
5
5
6
7
8
9

Any Suggestions?

Porcupine
  • 2.2k
  • 4
  • 26
  • 60