Help finding info from log file

Hi,

I have a log file that contains information such as this:

date
id number
command1
command2
command3
command4
data
data
data

date
id number
command1
command2
command3
command4
data
data
data
...and so on.

I need to find every time command3 was sent for a specific date. So I need to grep on 'this specific date' and 'command3' and send it to a log file. Is there a way to grep or awk down?

Yes it is possible, but pls give more clue :

How is the date formatted ? give an example of date you want to query
Which command you want to look for that specific date ?

Please give a "real-like" example of input you have and output you need, then people will be able to provide an accurate help.

Ok, sorry for not giving more.

Let's say the log file has this. The end of each entry is separated by a blank line and then the other command string is sent is displayed:

03/17/2011
id number
command1
command2
command3
command4
data
data
data
<blank line>
03/18/2011
id number
command1
command2
command3
command4
data
data
data
<blank line>
03/18/2011
id number
command1
command2
command3
command4
data
data
data

I want some code to do something like:

Read history.log
date=03/18/2011
commandissued=command4
where $date and $commandissues occurs in the same entry (in between blank lines> execute a count and display the results.

Does that help?

Execute the count of what ?
the number of time the command4 has been found for that date ?
or the total number of entries in all record containing the command 4 for that date ?

# cat tst
03/17/2011
id number
command1
command2
command3
command4
data
data
data

03/18/2011
id number
command1
command2
command3
command4
data
data
data

03/18/2011
id number
command1
command2
command3
command4
data
data
data
# set -- $(echo "03/18/2011 command4")
# awk -v d="$1" -v p="$2" '$1~d{x=1}NF<1{x=0}$0~p&&x{s++}END{print s}' tst
2
#
# awk -v d="$1" -v p="$2" '$1~d{x=1}NF<1{x=0}$0~p&&x' tst
command4
command4

I want to count every instance of command 4 for the date specified.