grep or awk or sed not sure which to use here

Hi All,

I have a huge file, I need to two things from this file. I need to know the IP address or the hostname and second thing is the date&time.

The file looks like this and I need to get my data from this...

Trying...
Connected to 204.109.172.117.
Escape character is '^]'.
Fri Oct 31 16:32:49 2008
Connection closed.
Trying...
Connected to meph1.xrb.com
Escape character is '^]'.
Fri Oct 31 13:38:31 2008
Connection closed.
Trying...
Connected to xrbcp1.xrb.com
Escape character is '^]'.
Thu Feb 26 11:23:27 2009
Connection closed.
Trying...
Connected to xrbcp2.xrb.com.
Escape character is '^]'.
Thu Feb 26 11:23:40 2009
Connection closed.
Trying...
Connected to 204.109.172.118.
Escape character is '^]'.
Fri Oct 31 16:32:49 2008
Connection closed.

I did grep -E and it's sort of working but not there 100%.

cat dst_result_02261123.txt |grep -E "Connected|Thu"

If I run the file on Friday or any other day, I have to change this grep -E value. I was wondering is there better way to do in awk or sed?

Thanks.

day=$( date +%a )
grep -e "$day" -e "Connected" dst_result_02261123.txt 

What does "sort of working" mean? What does it do, and how does that differ from what you want?

day=$1 ## specify day on the command line
grep -E "Connected|$day" dst_result_02261123.txt

I want to add blank line after each result. I have no idea what to command to use there.

Here is my result from grep -e

Connected to xrbarb1.xrb.quotron.com.
Thu Feb 26 11:23:26 2009
Connected to xrbarb2.xrb.quotron.com.
Thu Feb 26 11:23:26 2009
Connected to xrbcp1.xrb.quotron.com.

so I want the result to look like this.... Please let me know if I need to use sed or awk to do this?

Connected to xrbarb1.xrb.quotron.com.
Thu Feb 26 11:23:26 2009

Connected to xrbarb2.xrb.quotron.com.
Thu Feb 26 11:23:26 2009

Connected to xrbcp1.xrb.quotron.com.
Thu Feb 26 11:23:26 2009

Thanks again for your help.

day=$1
awk -v day=$day '/Connected/
$0 ~ day { print; print "" }' dst_result_02261123.txt