Sponsored Content
Top Forums Shell Programming and Scripting Collecting logs between two time stamps Post 302939868 by RudiC on Monday 30th of March 2015 01:52:16 PM
Old 03-30-2015
What has this
Code:
12:18:17,734 INFO  [xyzout] (ajp-/xx.xx.xx.xxx:1234-1) 2015-03-30 12:18:17,733:INFO . . . 
      [name_nname@email.domain.com.smb]: workingCreateQuotesFromabcdefData

to do with your problem resp. the sample given?

Code:
awk -F, '                                                               # run awk with field separator set to ","
function dform(v){                                                      # convert time string to binary representation
                    gsub(/[-:]/," ",v)                                  # replace "-" and ":" with " " in v
                    return mktime(v)                                    # do conversion
                 }
           NR==1 {                                                      # at start of file
                    start = dform(start)                                # convert start parameter
                     end  = dform(end)                                  # and end
                 }
    dform($1)!=-1{                                                      # if first field is a valid time string
                    f = dform($1)>=start && dform($1) <= end ? 1 : 0    # set "doprint" var "f" if $1 within boundaries   
                 }f                                                     # print line if "f"
        ' start="$from" end="$to" $log1 > /script/xyz.txt               # supply boundaries and log file; redirect

Be aware that mktime is not available in all awk versions.
You could use this snippet for your problem if you use [ ,] for the field separator and apply it to $10 instead of $1. It would not print the last line in your desired output, though.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

comparing time stamps

Hello All, I'm generating timestamps (file creation timestamps) for all the files in a directory. I need to compare all the timestamps. for example if i have 4 files and their timestamps are 20091125114556, 20091125114556,20091125114556,20091125114556 respectively. I need to differentiate... (1 Reply)
Discussion started by: RSC1985
1 Replies

2. Shell Programming and Scripting

comparing time stamps

Hello All, I'm generating timestamps (file creation timestamps) for all the files in a directory. I need to compare all the timestamps. for example if i have 4 files and their timestamps are 20091125114556, 20091125114556,20091125114556,20091125114556 respectively. I need to differentiate... (9 Replies)
Discussion started by: RSC1985
9 Replies

3. Red Hat

Collecting logs by running command

Hi, i am a general user of linux but we work mostly on windows next i am moving full time on linux. here is my question: We have product which consist or several subsystem each subsystem has one module to create logs file dump. and i am going to write that support dump tool. we need to... (3 Replies)
Discussion started by: ajayyadavmca
3 Replies

4. Shell Programming and Scripting

Time difference between two time stamps

Hi Friends, I have 2 varaibles which contain START=`date '+ %m/%d/%y %H:%M:%S'` END=`date '+ %m/%d/%y %H:%M:%S'` i want the time difference between the two variables in Seconds. Plz help. (2 Replies)
Discussion started by: i150371485
2 Replies

5. Shell Programming and Scripting

date time stamps in bash

I'm looking for a way to have the "date" command output the date in a specific format. I'm not familiar with the different ways to use the date command at all. i read up on it, but i dont get how to manipulate it. i know that i can get the date format to give me a format like: 2012-10-13... (6 Replies)
Discussion started by: SkySmart
6 Replies

6. Shell Programming and Scripting

Increment time stamps.

Hi Gents. Please can you help me to solve a problem. I have a long list of files, which I need to change the time stamp. -r--r--r-- 1 geo2 geovect 47096216 Feb 8 10:40 00000009.segd -r--r--r-- 1 geo2 geovect 47096216 Feb 8 10:40 00000010.segd -r--r--r-- 1 geo2 geovect 47096216 Feb ... (11 Replies)
Discussion started by: jiam912
11 Replies

7. Shell Programming and Scripting

How to get the Logs between two Time Stamps?

Hi, I have been working on the error Log script, where errors are pulled from server. I need to pull the data of the error logs between two dates & time, for example : 22/12/2014 20:00:00 22/12/2014 22:00:00 Whatever error have came during this duration. Now the question is the record... (6 Replies)
Discussion started by: amitgpta90
6 Replies

8. Windows & DOS: Issues & Discussions

Cygwin_openssh time stamps

I've installed cygwin_openssh on Windows 2012 R2 and it's working great. My issue is when a file is uploaded say from a different timezone, when it is uploaded, it doesnt pick up the sftp servers time.. Is there a way to fix that? i.e. When someone in PST uploads a file to this server in EST,... (0 Replies)
Discussion started by: MikeAdkins
0 Replies

9. UNIX for Advanced & Expert Users

Syslog-ng not working not collecting logs on rhel

Hi, I need help on syslog-ng on RHEL 7.2. It is working as expected. As per configuration, it is supposed to create authlog, messages and xymessages daily in respective folder of date. But I can see only messages file and that is also not updating well. # ps -ef | grep -i syslog root 22954... (1 Reply)
Discussion started by: solaris_1977
1 Replies
GR_PLOT_SHORT(1)						   User Commands						  GR_PLOT_SHORT(1)

NAME
gr_plot_short - plot short integer binary samples versus time using GNU Radio SYNOPSIS
gr_plot_short: [options] input_filenames DESCRIPTION
Takes a GNU Radio short integer binary file and displays the samples versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples. OPTIONS
-h, --help show this help message and exit -B BLOCK, --block=BLOCK Specify the block size [default=1000] -s START, --start=START Specify where to start in the file [default=0] -R SAMPLE_RATE, --sample-rate=SAMPLE_RATE Set the sampler rate of the data [default=1.0] SEE ALSO
gr_plot_char(1) gr_plot_const(1) gr_plot_fft_c(1) gr_plot_fft_f(1) gr_plot_float(1) gr_plot_int(1) gr_plot_iq(1) gr_plot_psd_c(1) gr_plot_psd_f(1) gr_plot_qt(1) gr_plot_short(1) gr_plot_short 3.5 December 2011 GR_PLOT_SHORT(1)
All times are GMT -4. The time now is 06:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy