grep from multiple lines in several gz files

Hello all,

I have been struggling to get grep work to my requirements. Basically I have to filter out patterns spread across multiple lines over hundreds of .gz files in a folder. And the output needs to be piped to a file.

Here is the example:
folder name: logs
files in this folder: log1.gz, log2.gz, .........,log400.gz
Each of these gz files contain various log files with separate transaction ids.
Here is a dummy example of a log file:

......
<transactionId1> [ignore this random string] ignore this line
<transactionId1> [ignore this random string] carrier: ER
<transactionId1> [ignore this random string] ignore this line
<transactionId1> [ignore this random string] ignore this line
<transactionId1> [ignore this random string] ticket number:
1234567890
<transactionId1> [ignore this random string] ignore this line
......

So when I run the script from the 'logs' folder, I want the output in this format:
transactionId1 ER 1234567890
transactionId2 RF 4566822347
transactionId3 FG 5673456834
......

Please note that in the example log above, the ticket number is actually on the next line. I have tried making this work with sed but failed. I would be glad to be advised by all you experts out there.

Many thanks in advance.

Regards,
Mandhan

Not sure, the ticket number is on the same line or separate line.

If separate:

gzcat log*.gz |awk '/carrier/{a=$1 FS $NF}/^[0-9]/{print a,$1}' 

If in the same line:

gzcat log*.gz |awk '/carrier/{a=$1 FS $NF}/ticket number/{print a,$NF}' 

Many thanks rdcwayx for your reply.

The string "ticket number:" and the actual ticket number "1234567890" are on two different lines.

Regards,
mandhan

little modification of rdcwayx code ..

$ gzcat log*.gz |awk '/carrier/{a=$1 FS $NF}/ticket number/{getline;print a,$NF}'
<transactionId1> ER 1234567890

Thanks again for your responses.
Your suggestions worked brilliantly with some of my own customizations. I made it into a shell script and fed the transaction id from a separate file to this script. Will post the script after I have tweaked it a bit more.

Regards,
mandhan