awk commands

gudii9 used Ask the Experts™
awk query
 unzip -c  xyz.log.20180905.gz| awk '$0>= "2013-Sep-09 18:33" && $0 <="2013-Sep-09 23:15"'| grep '|[1-9][0-9][0-9][0-9][0-9]|0000'|wc -l
Zip file too big (greater than 4294959102 bytes)
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
how to learn awk any good video tutorials on it?
please advise
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2014
Top Expert 2015
That error was reported by unzip, not by awk
Distinguished Expert 2017
.gz is a gzip, gunzip related compressed item, unzip deals with .zip files.
To add to ozo's comment.

Awk is the command,
As others it has programmability using begin/end to define blocks todo different things.

Please look at the manual (man awk) or on-line search for example uses of awk.

As in prior comment, your approach to learning is narrowed by own approach.

To acquire a wider understanding, consideration knowledge, instead of picking commands in a specific scenario and then seek explanation on what they do.

To better learn, understand
Post a question using the current example, in the following way,
I have an archive with the suffix gz
I would like to search for patterns within it, how should I approach that.

The answer will have to go in stages:
First, to display the contents of the archive without Uncompressing it permanently, use gzip -cd <xyz.log.20180905.gz but pipe it through head to grab the first 50 lines (|head -50) to provide it as a reference.
You chose to use awk. For oar sung processing, much depends on what and the scope,



i should have given

what is difference between gunzip and zgrep

please advise?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!


how gzip different?
Distinguished Expert 2017

Gzip is a command to compress or decompress
Grep is a command to search for pattern
Zgrep is a fairly recent integration of combining a function to facilitate a way to search for patterns using grep in a compressed archive
zgrep 'pattern' file.gz
Is a combination that previously was
gzip -cd <file.gz | grep 'pattern'

Think of it this way, gzip, grep were a sequence of functional process
Following repeated need, a new single step process, zgrep was developed.
Run ldd zgrep
And what you'll is inclusion of compression related libraries (functions) that are not included in ldd grep.
Most Valuable Expert 2014
Top Expert 2015

man unzip
man gunzip
man zgrep
man awk
should tell you the basics of those commands
the command
file xyz.log.20180905.gz
may help to determine the format of xyz.log.20180905.gz

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial