Remove empty lines from a file
You can use awk to strip a file of empty line. Do it with awk ‘NF>0’ < text_file
You can use awk to strip a file of empty line. Do it with awk ‘NF>0’ < text_file
Did you know you can ping all the hosts listed in the /etc/hosts file with one command? Do it with for i in `grep -v “^#” /etc/hosts | awk ‘{print $1}’`; do ping -c 1 -w 2 $i ; echo; done
Sed can be wonderful. Say you want to extract lines 34 through 78 from a text file and output them into another file. Do it with sed -n ‘34,78p’ < original.file > output.file
If you do a ls > file.txt, the output will contain a single column of text. If you want to use multiple columns, do a ls -C > file.txt