How to read/process a .gz file, one line at a time?

[LEFT]Hello

I'm stuck trying to solve this KSH issue and I'm hoping someone out there can offer some suggestions.

I want to read lots of large .gz files one line at a time in order to compare its Error entries with a list of known errors. I can't simply do "foreach ERROR do gzcat *.gz |grep ${ERROR}" because I would have to parse every single large log file for each of the known errors and the time to do that would be days. So I want to parse the log files only once, read each line, compare the error, and increment the error count for each error. I know how to do most of this except the part about processing one line at a time from a .gz file.

I came up with something like this but it's not working. It's outputing all the lines in the file, instead:[/LEFT]

 
while read file_line
do
ERROR=`grep ^ERROR ${file_line}`
print ${ERROR}
done < `gzcat 080803.gz`

This is the output that's coming out. It should output only the lines beginning with ERROR but it's showing everything such as the AUDIT lines. I want just the ERROR lines. And there is no carriage return.

AUDIT ; WebContainer : 2008-08-04 00:11:51,554 ; com.at.commons:A_EndRequest - Done preparing response for transaction for uri '/docroot/common' in 337 ms.^JAUDIT ; WebContainer : 2008-08-04 00:11:58,885 ; com.at.commons:A_BeginRequest - Received request for transaction for uri '/docroot/common'.^JAUDIT ; WebContainer : 20-08-08-04 00:11:59,136 ; com.at.commons:A_EndRequest - Done preparing response for transaction for uri '/docroot/common' in 251ms.^JAUDIT ; WebContainer : 2008-08-04 00:12:08,686 ; com.at.commons:A_BeginRequest - Received request for transaction for uri '/docroot/common'.^JAUDIT ; WebContainer : 2008-08-04 00:12:09,078 ; com.at.commons:A_EndRequest - Done preparing response for transaction for uri '/docroot/common' in 392 ms.: cannot open

I wanted the output to look like this instead:

ERROR ; WebContainer : 2008-08-03 04:33:45,787 ; com.models.userlist.query:E_AggregationError
ERROR ; WebContainer : 2008-08-03 04:33:59,930 ; com.models.userlist.query:E_AggregationError
ERROR ; WebContainer : 2008-08-03 04:34:31,751 ; com.app.cdmeng.combination:E_marshalException

What am I doing wrong? Any assistance would be much appreciated.

Thanks.

zgrep ^ERROR 080803.gz

Or:

zcat 080803.gz | grep ^ERROR

gzcat test1.gz|awk '/ERROR/{print $0}'

You can get with AWK like above