Delete blank lines from file – AWK Scripting

Delete blank lines from file

Here’s some ways to remove empty or blank lines from a file in Unix. Simple but definitely useful. Delete blank lines from file

$ grep -v '^$' file.txt
$ grep '.' file.txt
$ sed '/^$/d' file.txt
$ sed -n '/^$/!p' file.txt
$ awk NF file.txt
$ awk '/./' file.txt

In Vi editor, in escape mode type

:g/^$/ d
¬†Please provide your valuable comments…

unix shell scripting tutorial pdf,unix script examples,unix shell scripting tutorial,shell scripting tutorial,windows shell script examples,shell scripting pdf,unix shell scripting,korn shell scripting,shell scripting,unix shell programming pdf,ubuntu tutorials for beginners pdf,bash shell tutorial pdf,unix shell scripting examples,list of linux commands pdf,list of unix commands pdf,advanced bash scripting guide pdf,linux shell script example,bash scripts examples,bourne shell script example,unix script commands,sh file example,simple unix script,unix shell scripts,shell scripting tutorials point,shell scripting in unix,linux shell scripting tutorial,shell scripting tutorial point,unix scripting tutorial for beginners,windows shell scripting,windows shell script tutorial,windows cmd script tutorial,windows batch scripting,windows script file examples,windows 7 scripting tutorial,simple powershell script examples,cscript command examples,putty commands pdf,basic unix commands pdf,mastering unix shell scripting pdf,unix shell commands,unix shell commands list,unix tutorial,unix bash shell scripting,windows 10 unix shell,korn shell scripting cheat sheet,korn shell commands,unix shell script commands,korn shell if statement,ksh if statement options,unix shell scripting basics,linux programming for beginners pdf,list of all unix commands

Thanks for your wonderful Support and Encouragement

Ankam Ravi Kumar

Working as Linux / Storage Administrator L3. Interested in sharing the knowledge.

Leave a Reply

Your email address will not be published.