How to skip empty fields when printing?