I am newbie to perl. I have to write a script that read a file which is in .gz format. The task i have to do is to read line number 1 first which contains a header, extract the field from line one(which is a header of log format and it's gets chang everyday). This extracttion will give me an idea at which numbers (if i am copying in array) the logs of interest will be. After this i want to read one line at a time from .gz file, extract the log at specific spot in an array and copy it in .txt file and later displays in html format.
I just needed help with the reading part of .gz file. Any help is greatly appreciated.
The header format is for example
num,date,time,orig,type,action,alert,i/f_name,i/f_dir,Total logs,Suppressed logs,auth_method,reason
I am using right now
@ta = `gzcat logtext.20070318.zrc2s0mc.gz|head -1`;
which gives me the number of the field after comparison
If someone can help with to read a file one line after it like
@logfile = `gzcat logtext.20070318.zrc2s0mc.gz|head -I`;
where -I is a varaiable and gets incremented one line at a time till the files end and also they line in logs varied every day. so can not dump the whole file in an array like @ta = `gzcat logtext.20070318.zrc2s0mc.gz|head -2000`;
Please let me know if there is a way i can do this in perl.
Thanks in advance.