How to remove empty/blank lines from a file in Unix (including spaces)?

This sed line should do the trick:

sed -i '/^$/d' file.txt

The -i means it will edit the file in-place.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)