perl -i.bak -ne 'print if /\S/' file.txt