Both $
and \n
represents the end of a line. To remove an empty line we can use either :g/^$/d
or :%s/^\n//g
My questions are:
What's the difference between these two signs?
It seems the first command removes a line while the latter one replaces a line by nothing. Hence the first one should be more efficient than the second one. Is my analysis correct?
What about the comparison between :g/^$/d
and :g/^\n/d
?