Delete empty lines in a fileSome times there are some empty lines which we feel are redundant in the file and want to remove them.Below is the command in unix to do that.
sed -i '/^$/d' your_fileBut there is also another way to do this:
grep . your_file > dest_fileIn perl also we can acheive this as below:
perl -pi -e 's/^$//g' your_filethe above mentioned perl and sed solutions will do an inplace replacement in the file
If in case the lines have some spaces then:
perl -pi -e 's/^\s*$//g' your_file