Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

query on count

zgrep 'XYZ|AB|MASTER' AAAA.log.20180904.gz | grep '|[1-9][0-9][0-9][0-9][0-9]|0000' | wc -l

can you please advise what is the meaning of above zgrep command

where i can find, practice and learn above kind of commands

how grep and egrep are different

https://ryanstutorials.net/linuxtutorial/grep.php
how to learn regular expressions used in queries

Please advise
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

grep '|[1-9][0-9][0-9][0-9][0-9]|0000' | wc -l

does it find transactions taking more than 20 seconds?

how to make to find transactions taking more than 30 seconds

how to make to find transactions taking more than 50 seconds

how to make query to nd transactions taking more than 60 seconds between 11:43 to 22:15 on 09/05/2018
please advise
Avatar of gudii9

ASKER

how awk different from regular expression?
the above is looking for a pattern of numbers,
you have to post the line that is returned to determine what it means.

AWK is a text processor it can use a regular expression,

awk -F ' (check condition) { print } ' filename

post a line from the log
(though you currently use a compressed archive as the starting point.)

then ask your question based on the information

regualr expressions are a way to search for patterns rather than specific words..

awk is command similar to cut while regular expression is implemented in many different environments
i.e. [0-9] means search for a number between 0 and 9

there are many resources. I find it best to learn when I need something done.

versus learning in the abstract.
Avatar of gudii9

ASKER

the above is looking for a pattern of numbers,
you have to post the line that is returned to determine what it means.

it reurned
142


which means number of transactions 142 taking more than 30 seconds
Avatar of gudii9

ASKER

any good video tutorials around these topics to understand deeply and better?
the output of wc -l return a line number count.

To address your question on regular expression one needs to see the input which are the actual lines
i.e. the output of zgrep
then the output of the earlier line passed though  grep.

based on these sets of data we can answer whether the end count which in the snapshot is 142 means that there were 142 instances that took longer than 20 seconds, it might appear so, but it might not be the basis on which the current basis of information.

https://www.shortcutfoo.com/app/dojos/regex/cheatsheet
https://www.rexegg.com/regex-quickstart.html

these are no uniformly implemented in terms of if you use perl the reg ex might deviate slightly. tcl/tk
sql, etc.

I've seen complex variation where you can span multiple lines or get data through the query spannning multiple lines...


use what you have
run the first command and see the output.
run the first passing

Explore the data you have as I suggested so that you can see what the zgrep command does and its results.
Then run the first passing the data to the grep secodary command and then see what it shows.

......