Thank You very much for looking into my problem and providing me the script. I tested it and it worked fine means it executed well without any error. I need to verify the time diffrences here and let you know.
I want to know some explanation here---
What is the use of shift here, later part of the (OR ||) i know.
Is this fuction parameters. It does not have any name.
what this line is going to do?
what this line explains?
Is subtract_datetime some standard function in DateTime.
What is the use of shift here, later part of the (OR ||) i know.
If the first argument passed to the script (i.e. the value returned by the shift function) is true in boolean context,
assign that value to the variable logfile, otherwise exit with error. If you name your input file 0, the code above wont work
Quote:
Is this fuction parameters. It does not have any name.
This is just a declaration, it's the same as:
Quote:
what this line is going to do?
Assign the list returned by the splitting of the $_ variable to the array dtA (date Array). split by default splits on whitespace (after skipping any leading whitespace).
Quote:
what this line explains?
It's the ternary operator: expression ? if true evaluate this:if false evaluate that.
If the current input record ($_) matches the pattern in // assign the returned object to the reference $end_dt, otherwise assign it to the reference $start_dt.
Quote:
Is subtract_datetime some standard function in DateTime.
Yes, subtract_datetime is one of the available methods in the DateTime class.
Can you help me to collect the entire logs between two time stamp. The below awk command collecting the logs only if the line has time stamp.
awk '$0>=from && $0<=to' from="150318 23:19:04" to="150318 23:55:04" log file
150318 23:19:04 logentries
150318 23:29:04 logentries
150318... (11 Replies)
I was looking at this script which outputs the two lines which differs less than one sec.
#!/usr/bin/perl -w
use strict;
use warnings;
use Time::Local;
use constant SEC_MILIC => 1000;
my $file='infile';
## Open for reading argument file.
open my $fh, "<", $file or die "Cannot... (1 Reply)
Hello All,
I have a file like below....
dn: cn=user1,ou=org,o=org
cn=user1
uid=user1
cn=user2,ou=org,o=org
cn=user2
uid=user2
cn=user3,ou=org,o=org
cn=user3
cn=user33
uid=user3
cn=user4,ou=org,o=org
cn=user4
uid=user4 (6 Replies)
Hello community,
what I need to do is read 2 rows at time from a file. I have this simple solution:
File to read:
LINE1
LINE2
LINE3
LINE4
LINE5
LINE6
LINE7
LINE8Read routine:#!/bin/ksh
sed '1,3d' /out.txt | while read line; do
read line2
echo $line $line2
doneResult:LINE1... (5 Replies)
Hello
I have a file in following format:
IV 08:09:07
NM 08:12:01
IC 08:12:00
MN 08:14:20
NM 08:14:15
I need a script to compare time on each line with previous line and show the inconsecutive line. Ex.:
08:12:00
08:14:15
A better way... (6 Replies)
Hi All,
I am lookig for a way to get all the lines from a log file which has been updated 5 mins prior to the system time.
The log file will be like below:
09:01:00 Started polling
09:01:05 Checking directory test
09:02:00 Error! Cannot access directory test
09:03:00 Polling
I get... (8 Replies)
Hi,
anyone has any ideas on how do we extract lines from a file with format similiar to this: (based on current time)
Jun 18 00:16:50 .......... ............. ............
Jun 18 00:17:59 .......... ............. ............
Jun 18 01:17:20 .......... ............. ............
Jun 18... (5 Replies)
Hello Friends,
I want to write a script for the following:
nlscux62:tibprod> grep "2008 Apr 30 01:" SA_EHV_SPEED_SFC_IN_03-SA_EHV_SPEED_SFC_IN_03-2.log | grep -i post | more
2008 Apr 30 01:01:23:928 GMT +2 SAPAdapter.SA_EHV_SPEED_SFC_IN_03-SA_EHV_SPEED_SFC_IN_03-2 Info AER3-000095 IDOC... (2 Replies)
Hi,
I'm trying to accomplish the following and would like some suggestions or possible bash script examples that may work
I have a directory that has a list of log files that's periodically dumped from a script that is crontab that are rotated 4 generations. There will be a time stamp that is... (4 Replies)
Hi,
I am trying to caluate the time elasped by the job to run.For that i have used the following command:
I have one file which contains the following
more start.txt
991 STARTED Fri Aug 10 14:04:20 2007
Starting Job JOB_NAME. (...)
1036 STARTED Fri Aug 10 14:04:31 2007
... (1 Reply)