06-01-2006
How to find date Difference in AWK/GAWK with millisecond precision
Hi,
I have a log file that has the date in this format
"2006-05-30_13:14:04,256". I need to find the time difference between two log entries in milliseconds.
How to achieve this in AWK/GAWK script?
10 More Discussions You Might Find Interesting
1. Programming
Hi,
I need to time a certain function in my C/C++ code and I am experiencing some difficulties. I timed it using wallclock time so I know that it takes approximately 500-600 microseconds with
gettimeofday(&start, NULL);
// my function call
gettimeofday(&end, NULL);
answer = (end.tv_sec -... (2 Replies)
Discussion started by: zynnel
2 Replies
2. Shell Programming and Scripting
1.56.253.48 - - "GET "
1.6.253.48 - - "GET "
1.65.253.48 - - "GET "
1.65.253.48 - - "GET "
1.63.53.48 - - "GET "
1.65.253.48 - - "GET "
1.16.23.48 - - "GET "
1.64.25.48 - - "GET "
need command which give the output
1.6.253.48 - 09/Nov/2009:07:02:24
1.65.253.48 -... (7 Replies)
Discussion started by: sagar_evc
7 Replies
3. Shell Programming and Scripting
hi,
I am a new awk user, now i want to change my result from
1 ca 0.2057422D-01 -0.7179106D-02 -0.5600872D-02
2 o 0.2463722D-01 -0.1554542D-01 0.3110649D-01
3 h -0.1068047D-01 0.1016889D-01 -0.4088230D-02
to
1 ca 0.02057422 -0.007179106 -0.005600872
2 o 0.02463722 -0.01554542 ... (4 Replies)
Discussion started by: wanchem
4 Replies
4. Shell Programming and Scripting
Hi,
Could anyone help me to solve this problem?
I have two files "f1" and "f2" having 2 fields in each, a) file size and b) file name. The data are almost same in both the files except for few and new additional lines. Now, I have to find out and print the output as, the difference in the... (3 Replies)
Discussion started by: royalibrahim
3 Replies
5. Shell Programming and Scripting
Hi All,
could any body let me know.
how to get timestamp with millisecond precision in unix bash shell.
example -->2005-12-06- 4-22-35-195
please help me.
Thanks,
Krupa:wall: (3 Replies)
Discussion started by: krupasindhu18
3 Replies
6. Shell Programming and Scripting
Why the below option2 doesn't fetch similar output as option1 ? I am on linux.
$cat test
2013-01-01-00.25.43.643845
Option1:
cat test | gawk -F"-" ' {print $2 " " $3 " " $1}'
01 01 2013
Option2:
cat test | gawk '{FS="-"} {print $2 " " $3 " " $1}'
2013-01-01-00.25.43.643845 (5 Replies)
Discussion started by: Shivdatta
5 Replies
7. Shell Programming and Scripting
Hi all,
Need an urgent help on the below scenario.
script:
awk -F","
'BEGIN { #some variable assignment}
{ #some calculation and put values in array}
END {
year=#getting it from array and assume this will be 2014
month=#getting it from array and this will be 05
date=#... (7 Replies)
Discussion started by: vijaidhas
7 Replies
8. Shell Programming and Scripting
Hi All,
Solaris 10 o/s
With your help I developed the following script.
find /oracle/diag/rdbms/*/*/trace -type f -name '*d00*.trc' -mtime 0 -exec egrep –c 'NS Primary Error' '{}' '+'
which returns the counts I needed nelow:
/oracle/diag/rdbms/musidp/musidp/trace/abcdef_d001_21751.trc:15... (9 Replies)
Discussion started by: bdby
9 Replies
9. UNIX for Advanced & Expert Users
Hello, am not able to subtract timestamps in milliseconds.
I extract the timestamp as a string, and then try to subtract the two, but since it is a string, system just outputs 0
awk -F"," 'substr($1,0,13) - substr($2,0,013)' File
where $1 and $2 are the timestamps in the format... (4 Replies)
Discussion started by: sidnow
4 Replies
10. UNIX for Beginners Questions & Answers
Hello,
In HP-UX how to find the date time difference ?
Start time: 28-APR-2019 21:36:01
End time : 29-APR-2019 00:36:04
----------------------
Difference is
----------------------
Much appreciate any pointer or view on this.
... (3 Replies)
Discussion started by: Siva SQL
3 Replies
LEARN ABOUT CENTOS
varnishncsa
VARNISHNCSA(1) VARNISHNCSA(1)
NAME
varnishncsa - Display Varnish logs in Apache / NCSA combined log format
SYNOPSIS
varnishncsa [-a] [-b] [-C] [-c] [-D] [-d] [-f] [-F format] [-I regex] [-i tag] [-n varnish_name] [-m tag:regex ...] [-P file] [-r file]
[-V] [-w file] [-X regex] [-x tag]
DESCRIPTION
The varnishncsa utility reads varnishd(1) shared memory logs and presents them in the Apache / NCSA "combined" log format.
The following options are available:
-a When writing to a file, append to it rather than overwrite it.
-b Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishncsa acts as
if they both were.
-C Ignore case when matching regular expressions.
-c Include log entries which result from communication with a client. If neither -b nor -c is specified, varnishncsa acts as if they
both were.
-D Daemonize.
-d Process old log entries on startup. Normally, varnishncsa will only process entries which are written to the log after it starts.
-f Prefer the X-Forwarded-For HTTP header over client.ip in the log output.
-F format
Specify the log format used. If no format is specified the default log format is used. Currently it is:
%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i"
Supported formatters are:
%b Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a '-' rather than a 0 when no bytes are sent.
%H The request protocol. Defaults to HTTP/1.0 if not known.
%h Remote host. Defaults to '-' if not known. Defaults to 127.0.0.1 for backend requests.
%{X}i The contents of request header line X.
%l Remote logname (always '-')
%m Request method. Defaults to '-' if not known.
%q The query string, if no query string exists, an empty string.
%{X}o The contents of response header line X.
%r The first line of the request. Synthesized from other fields, so it may not be the request verbatim.
%s Status sent to the client
%t Time when the request was received, in HTTP date/time format.
%U The request URL without any query string. Defaults to '-' if not known.
%u Remote user from auth
%{X}x Extended variables. Supported variables are:
Varnish:time_firstbyte
Time to the first byte from the backend arrived
Varnish:hitmiss
Whether the request was a cache hit or miss. Pipe and pass are considered misses.
Varnish:handling
How the request was handled, whether it was a cache hit, miss, pass, pipe or error.
-m tag:regex only list records where tag matches regex. Multiple
-m options are AND-ed together.
-n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used.
-P file
Write the process's PID to the specified file.
-r file
Read log entries from file instead of shared memory.
-V Display the version number and exit.
-w file
Write log entries to file instead of displaying them. The file will be overwritten unless the -a option was specified.
If varnishncsa receives a SIGHUP while writing to a file, it will reopen the file, allowing the old one to be rotated away.
-X regex
Exclude log entries which match the specified regular expression.
-x tag Exclude log entries with the specified tag.
If the -o option was specified, a tag and a regex argument must be given. varnishncsa will then only log for request groups which include
that tag and the regular expression matches on that tag.
SEE ALSO
o varnishd(1)
o varnishhist(1)
o varnishlog(1)
o varnishstat(1)
o varnishtop(1)
HISTORY
The varnishncsa utility was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS. This manual page
was written by Dag-Erling Smorgrav <des@des.no>.
COPYRIGHT
This document is licensed under the same licence as Varnish itself. See LICENCE for details.
o Copyright (c) 2006 Verdens Gang AS
o Copyright (c) 2006-2011 Varnish Software AS
AUTHOR
Dag-Erling Smorgrav
1.0 2010-05-31 VARNISHNCSA(1)