azzazzello
Technical User
Greetings!
I have the following problem. A program I run generated a data file. That data file is very large. It gets gzipped on the fly. Gzipped it could be several gigabytes large. If the data file is completed, it has the word DONE as the last line. This is variable - I can print out anything I want there. Otherwise, the datafile is truncated and deemed "bad". So here I am face-to-face with this file. I need to check for a particular pattern in the last line. However, the fastest way I can think of of doing it is zcat $file | tail -1. Zcat will take 30 seconds for a 1GB file on this machine. Is there another way of doing it? I cannot touch done files or something of the sort. Basically have to quickly extract if the last line of a gzipped file is a pattern I am looking for.
I have the following problem. A program I run generated a data file. That data file is very large. It gets gzipped on the fly. Gzipped it could be several gigabytes large. If the data file is completed, it has the word DONE as the last line. This is variable - I can print out anything I want there. Otherwise, the datafile is truncated and deemed "bad". So here I am face-to-face with this file. I need to check for a particular pattern in the last line. However, the fastest way I can think of of doing it is zcat $file | tail -1. Zcat will take 30 seconds for a 1GB file on this machine. Is there another way of doing it? I cannot touch done files or something of the sort. Basically have to quickly extract if the last line of a gzipped file is a pattern I am looking for.