We help IT Professionals succeed at work.

awk commands

197 Views
Last Modified: 2019-01-10
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
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
yes
 unzip

i should have given
gunzip


what is difference between gunzip and zgrep

please advise?

Author

Commented:
how gzip different?
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
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.
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
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