Delete blank lines in a file

Hi All,

I have a file and I need to delete the lines that are blank and is starting with some characters below. Something like below:

Regular Ascii File:

Line1:  AGODA1	BUSAN||SK	Lord Beach	4/6/2012	4/7/2012	68060
Line2:  AGODA2	BUSAN||SK	Beach Hotel	4/6/2012	4/7/2012	610200
Line3:  Skahds4
Line4:  AMAN12	CHI	MMa	4/6/2012	4/7/2012	612134
Line5:  Depp
Line6:  ROGER|south|MMa1|4/6/2012|4/7/2012|53106
Line7:  Mango
And so on

I need to delete the lines that has character in the beginning but nothing after that. In my case, I need to delete lines 3, line 5 and line 7(which are shown in bold above).

I will really appreciate any advice.

I'm assuming it doesn't actually have the 'Line:' junk at the front of the lines.

awk -F'|' 'NF>1' < inputfile > outputfile

Thanks a bunch for replying. This was really helpful. I not very good in awk. I would really appreciate if you can help me understand the awk statement below:

awk -F'|' 'NF>1'

-F'|'

Use a field-separator of |. So it would consider a line like A|B|C|D|E to have 5 fields.

'NF>1'

Print all lines with more than one field. So lines with no | in them get ignored.

A bare expression like that is an implied 'if(X) { print }'. A fuller form which does the same thing would look like

awk -F'|' '{ if(NF>1) print }' filename

the awk statement defines a "field separator" character, in this case the vertical bar character "|", using the argument

-F'|'

then uses the awk built-in "field count" variable "NF" to output only lines which contain greater than one field.

based on your sample input, I don't think this is precisely what you want, as your "line4" would not be output. The default field separator is any whitespace character, which may be sufficient, so you can try the following variation and compare your results.

awk 'NF>1' < inputfile > outputfile