[font=Verdana]There are many ways to achieve this and they should work on all unixes:[/font]
[font=Verdana]With grep:[/font]
gz@shell~$ grep -v '^[[:space:]]*$'gz@shell~$ grep -v ‘^$’ filegz@shell~$ grep ‘.’ file[font=Verdana]With awk:[/font]
gz@shell~$ awk '{ if (length($0) > 0){ print $0 }}'gz@shell~$ awk NF filegz@shell~$ awk ‘/./’ file[font=Verdana]With sed:[/font]
gz@shell~$ sed ‘/^$/d’ filegz@shell~$ sed -n ‘/^$/!p’ file[font=Verdana]Know more? Leave a message :)[/font]
- Log in to post comments
- 15959 views