FAQ : How to use grep command to remove blank lines from file
Answer: To remove the blank lines from file, use the given below syntax
grep -v '^$' /path/of/file-name
In above command,
-v = Invert the sense of matching, to select non-matching lines
^$ = It is regex. ^ means start with and $ means end with. Combining both ^$ means blank lines
Example (With screenshot):
In below given file, contents have some lines in between
Now using grep command to remove blank line from file.