VI "delete blank lines"

i've deleted hundreds of lines in a file, i need to remove the blank lines.

tried doing this but can't get it right.

:%s/^$//

what am i missing?
bt707Asked:
Who is Participating?
 
ahoffmannConnect With a Mentor Commented:
:g/^$/d
0
 
bt707Author Commented:

also tried useing this

:%s/^$//g

it just does a substitute and replaces the blank lines with blank lines.........lol
0
 
bt707Author Commented:

grep -v "^$" filename > newfilename


this works but still trying to find how to do it in VI
0
 
bt707Author Commented:
Thanks ahoffmann, worked Great!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.