Sponsored Content
Full Discussion: How to compare datetime?
Top Forums Shell Programming and Scripting How to compare datetime? Post 302669529 by ajayakunuri on Wednesday 11th of July 2012 04:57:46 AM
Old 07-11-2012
This is the entire code:
Code:
#!/bin/ksh
conf=BS.config
Appl=""
st_dt=""
end_dt=""
status=""
job_start_date=""
job_start_time=""
today=$1
exec<$conf
while read job
do
        set -A Arr $job
        appl=${Arr[0]}
        avg_st_time=${Arr[3]}
job1=${Arr[1]}
job_start_date=`grep $job1 /opt/CA/ca7/sche/log/ga016dcf/ca7en2.out|tail -2|head -1|cut -d " " -f11`
job_start_time=`grep $job1 /opt/CA/ca7/sche/log/ga016dcf/ca7en2.out|tail -2|head -1|cut -d " " -f12`
#echo $today $job_start_date | awk '
#BEGIN {
#       d[1]= 31
#       d[2]= 28
#       d[3]= 31
#       d[4]= 30
#       d[5]= 31
#       d[6]= 30
#       d[7]= 31
#       d[8]= 31
#       d[9]= 30
#       d[10]= 31
#       d[11]= 30
#       d[12]= 31
#}
#{
#       yr=substr($1,7,4); mon=substr($1,1,2); day=substr($1,4,2)
#       yr1=substr($2,7,4); mon1=substr($2,1,2);day1=substr($2,4,2)
#       if((yr % 4 ==0 && yr % 100 !=0) || yr % 400 ==0) { d["02"] = 29;}
#       if ((yr1 - yr)==0 && (mon1-mon)==0 && (day1-day)==0)
#       {
#       echo $job_start_time
#       st_time=$((`echo $job_start_time|sed 's/.//g'`))
#       echo $st_time
#               }
#}'

printf "%12s|%5s|%10s|%10s|%10s|\n" $appl $avg_st_time $job1 $job_start_date $job_start_time
unset Arr
Appl=""
st_dt=""
end_dt=""
status=""
job_start_time=""
job_start_date=""
done
echo "\n\n"
exit 0

Config file:
Code:
Rockport        PDWRCK01        PDWRCK03        22:00
WIM     PDWIM000        PDWIM050        00:05

Sample log file:
Code:
grep PDWRAD ca7en2.out|tail -2
.CASH_I_0798 JOBINIT record being written for job 'PDWRADC2'   07/11/2012 04.18.04
.CASH_I_0799 JOBTERM record being written for job 'PDWRADC2'   07/11/2012 04.18.56


Last edited by zaxxon; 07-11-2012 at 06:07 AM.. Reason: some more code tags
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

datetime.pm

Hi, I'm trying to use datetime.pm function in Perl. I do not have in the library. Is there a way to get it and put it into library? Thanks, George. (1 Reply)
Discussion started by: gpaulose
1 Replies

2. Shell Programming and Scripting

Awk new datetime everyline

Hi, I'm using awk in HP-UX machine which does not support systime(), strftime(). So to get the date time I was using : seq 1 100000 | awk ' "date +%Y%m%d%H%M%s" | getline curtime; print curtime }' However the above code gets the date only once, next time it is not updated. For... (2 Replies)
Discussion started by: Random_Net
2 Replies

3. Programming

SQL datetime calculation

Suppose I have a mysql table consisting of measurements taken during irregular intervals as follows: CREATE TABLE data (datetime DATETIME, value INTEGER); mysql> SELECT datetime, value FROM data; +---------------------+---------+ | datetime | value |... (2 Replies)
Discussion started by: figaro
2 Replies

4. Shell Programming and Scripting

datetime difference in seconds

Hi, I'm trying to find processing time of my script. Please can someone give me the commands to get the start/end time in "dd-mm-yyyy hh:mm:ss" and the differnce in seconds. Thanks! (5 Replies)
Discussion started by: dvah
5 Replies

5. Shell Programming and Scripting

How to generate datetime string?

Hi. I'm hoping there is a simple method where I'm able to generate a datetime string that looks like this (yyyymmddhhmm): 201106280830 The tricky part would be that I need this string to be today's datetime minus 1 year. Is there anyway to do this? (3 Replies)
Discussion started by: buechler66
3 Replies

6. Shell Programming and Scripting

Adding 48 hours to DateTime

Hey Guys, I have looked for a solution throughout the forum for my particular question, but I cant find one. So I'm sorry if I overlooked it. I need to be able to 48 add hours to a particular DateTime string. I have a variable named $startTime I would like to be able to take that... (1 Reply)
Discussion started by: chagan02
1 Replies

7. UNIX for Dummies Questions & Answers

Find files between two datetime..

Hi All, How do i find all the files between two times. Eg: 26 may 2014 06:00 to 26 may 2014 14:00 mmin and mtime gives for a specific period. we receive hundreds of files input directories and i need to find how many files are received between given specific datetime. Thanks. (2 Replies)
Discussion started by: abhi_123
2 Replies

8. Shell Programming and Scripting

SunOS compare datetime

Hi i need to compare the datetime between 2 columns. SunOS 5.1 is used. Notice that mktime seems like not supported. cat file2 P1,2012 12 4 21 36 48,2012 12 4 22 26 53 P2,2012 12 4 20 36 48,2012 12 4 21 21 23 P3,2012 12 4 18 36 48,2012 12 4 20 12 35 Below is the command used.... (1 Reply)
Discussion started by: chailee
1 Replies

9. Shell Programming and Scripting

Filename with datetime

Hello All, I need unix command to generate a file with datetime in it. For example : ABC_YYYYMMDDHH24MISS.txt Regards Biswajeet Ghosh (1 Reply)
Discussion started by: bghosh
1 Replies
nsd-checkconf(8)						    nsd 3.2.12							  nsd-checkconf(8)

NAME
nsd-checkconf - NSD configuration file checker. SYNOPSIS
nsd-checkconf [-v] [-h] [-o option] [-z zonename] [-s keyname] configfile DESCRIPTION
nsd-checkconf reads a configuration file. It prints parse errors to standard error, and performs additional checks on the contents. The configfile format is described in nsd.conf(5). The utility of this program is to check a config file for errors before using it in nsd(8) or zonec(8). This program can also be used for shell scripts to access the nsd config file, using the -o and -z options. OPTIONS
-v After reading print the options to standard output in configfile format. Without this option, only success or parse errors are reported. -h Print usage help information and exit. -o option Return only this option from the config file. This option can to be used in conjunction with the -z option. The special value zones prints out a list of configured zones. This option is primarily used by nsdc to parse the config file from the shell. If the -z option is given, but the -o option is not given, nothing is printed. -s keyname Prints the key secret (base64 blob) configured for this key in the config file. Used to help shell scripts parse the config file. -z zonename Return the option specified with -o for zone 'zonename'. If this option is not given, the server section of the config file is used. This option is primarily used by nsdc to parse the con- fig file from the shell. The -o, -s and -z option print configfile options to standard output. FILES
/etc/nsd3/nsd.conf default NSD configuration file SEE ALSO
nsd(8), nsdc(8), nsd.conf(5), nsd-notify(8), nsd-patch(8), nsd-xfer(8), zonec(8) AUTHORS
NSD was written by NLnet Labs and RIPE NCC joint team. Please see CREDITS file in the distribution for further details. NLnet Labs jul 19, 2012 nsd-checkconf(8)
All times are GMT -4. The time now is 12:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy