Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

remove empty line

Status
Not open for further replies.

dbase77

Technical User
Apr 23, 2002
591
IE
HI,

If I have data like below:

==========================
I like cat.
He is sleeping.

She is eating.
Date: 12/02/03

They like me.
I like you.

Date: 18/04/03
==========================

How do I go about deleting the empty line? This file contain random empty line which I want to delete. This file contain more than 100 pages. What Im trying to do is to import this file into excel.

And any way I could put empty line adter each "Date" line? For example:

==========================
I like cat.
He is sleeping.
She is eating.
Date: 12/02/03

They like me.
I like you.
Date: 18/04/03
==========================


Thank you in advance.

regards,
feroz
 

nawk -f date.awk myFile.txt

#------------- date.awk
/^$/ { next }
/^Date:/ { print; print ""; next}
1

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
or better yet:

#---------------- date.awk
/^$/ { next }
1
/^Date:/ { print &quot;&quot;}


vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
HI,

Thank you for replying. It worked they way I want it. Thank again.

regards,
feroz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top