How to add a line

Hi,

Below is the result from my script.... I want to add a line after the time or third line should be empty... Please advise.

Connected to xrbarb1.xrb.com.
Wed Oct 28 15:15:58 2009^M
Connected to xrbarb2.xrb.com.
Wed Oct 28 15:15:57 2009^M
Connected to xrbcp1.xrb.com.
Wed Oct 28 15:15:58 2009^M
Connected to xrbcp3.xrb.com.
Wed Oct 28 15:15:58 2009^M
Connected to xrbcp4.xrb.com.
Wed Oct 28 15:15:58 2009^M
Connected to xrbcp5.xrb.com.
Wed Oct 28 15:15:59 2009^M
Connected to xrbcp6.xrb.com.
Wed Oct 28 15:16:01 2009^M

But I want to add a line after the time... For example.

 
Connected to xrbarb1.xrb.com.
Wed Oct 28 15:15:58 2009^M

Connected to xrbarb2.xrb.com.
Wed Oct 28 15:15:57 2009^M

Connected to xrbcp1.xrb.com.
Wed Oct 28 15:15:58 2009^M

Connected to xrbcp3.xrb.com.
Wed Oct 28 15:15:58 2009^M

Connected to xrbcp4.xrb.com.
Wed Oct 28 15:15:58 2009^M

Connected to xrbcp5.xrb.com.
Wed Oct 28 15:15:59 2009^M

Connected to xrbcp6.xrb.com.
Wed Oct 28 15:16:01 2009^M

awk 'NR > 1 && NR%2 { print "" }1' file1
Connected to xrbarb1.xrb.com.
Wed Oct 28 15:15:58 2009^M

Connected to xrbarb2.xrb.com.
Wed Oct 28 15:15:57 2009^M

Connected to xrbcp1.xrb.com.
Wed Oct 28 15:15:58 2009^M

Connected to xrbcp3.xrb.com.
Wed Oct 28 15:15:58 2009^M

Connected to xrbcp4.xrb.com.
Wed Oct 28 15:15:58 2009^M

Connected to xrbcp5.xrb.com.
Wed Oct 28 15:15:59 2009^M

Connected to xrbcp6.xrb.com.
Wed Oct 28 15:16:01 2009^M

Or

awk '1; !(NR%2) { print ""}' file1 

(you probably want to lost the ^M characters too - they're a pain!)

Something like that ?

awk '{sub(/\^M/,RS)}1' file

It's working... Thank you so much. :slight_smile: