Joining 2 lines in a file together

Hi guys,

I've got a log file which has entries that look like this:

-------------------------------------------------------------------------------
06/08/04 07:57:57
AMQ9002: Channel program started.

EXPLANATION:
Channel program 'INSCCPQ1.HSMTSPQ1' started.
ACTION:
None.
-------------------------------------------------------------------------------

I need a script which will extract the error code and date and display the results like this:

06/08/04 07:57:57 AMQ9002: Channel program started.

So basically it joins the date and AMQ code lines together and then greps on AMQ. The error code ALWAYS starts with AMQ.

Can anyone offer any suggestions on if that can be done?

Thanks

Gareth

something to start with:

nawk -f m22.awk logFile

this is m22.awk:

BEGIN {
  FS=RS=""
}

$1 ~ /^[0-9]/ {
   print $1 " " $2
}

awk '{ if ($1 ~ /^[0-9]/) { Ln=$0;getline;print Ln" "$0 }}' <filename> will do it

thank you, thank you, this works a treat. I'd buy you a pint if you were local!