Sponsored Content
Full Discussion: Date and time difference
Top Forums UNIX for Dummies Questions & Answers Date and time difference Post 302651759 by vanand420 on Wednesday 6th of June 2012 06:47:50 AM
Old 06-06-2012
Date and time difference

Hi,

I am trying to use the script as under :
Code:
echo "Please input the string (APC) in the format (APC=x-yyy-z):"
read a
for i in m1 m2 m4 m5 m6
do
cat /m12/$i/12* | grep -B 1 -A 1 inaccessible | gawk '/'$a'/{print $6,$7,$8,x};{x=$3" "$4}' | awk NF > temp 
cat /m122/$i/12* | grep -B 1 -A 1 -w accessible | gawk '/'$a'/{print $5,$6,$7,x};{x=$3" "$4}' | awk NF >> temp
cat temp | sort -k 4,5 
done
rm temp

output looks like this :
Code:
OPC=4-014-7 APC=2-232-1 inaccessible 12-05-16 15:32:20
OPC=4-014-7 APC=2-232-1 accessible 12-05-16 15:32:37
OPC=4-014-7 APC=2-232-1 inaccessible 12-05-16 15:33:12
OPC=4-014-7 APC=2-232-1 accessible 12-05-16 15:33:24

I want to just perform the output to be like this :
Code:
OPC=4-014-7 APC=2-232-1 inaccessible 12-05-16 15:32:20 accessible 12-05-16 15:32:37
 <Difference of 12-05-16 15:32:37 - 12-05-16 15:32:20> i.e 17 in this case.

Thanks in advance.

Moderator's Comments:
Mod Comment Please use next time code tags for your code and data

Last edited by vbe; 06-06-2012 at 08:17 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Date and time difference

Hi, I am starting a process at 9 pm today and want to exit the process by 5am, the next day. Every day at 9pm the shell script will be invoked by autosys. But how can i monitor in my script for 5 am and stop the process ? there may be a case where the script can start at 4.59 am and... (4 Replies)
Discussion started by: risshanth
4 Replies

2. Shell Programming and Scripting

About date & time difference

Hello All, I was having a look on threads on the Forum about time calculation but didn't find exactly this issue. For instance, if we have these 2 dates, begin & end : 20100430235830 20100501000200 Is there anyway, awk, ksh, perl to calculate the difference in sec and get for... (6 Replies)
Discussion started by: rany1
6 Replies

3. Shell Programming and Scripting

How to calculate time difference between start and end time of a process!

Hello All, I have a problem calculating the time difference between start and end timings...! the timings are given by 24hr format.. Start Date : 08/05/10 12:55 End Date : 08/09/10 06:50 above values are in mm/dd/yy hh:mm format. Now the thing is, 7th(08/07/10) and... (16 Replies)
Discussion started by: smarty86
16 Replies

4. Shell Programming and Scripting

Date and time difference

Hi, Below is the backup file name (includes date & time) : exp_trx_tables_18_Oct_2010_10_59_00.dmp Extracted date and time from the file name as below using the below "awk"command: date 18-Oct-2010 and time 10:59:00 echo "$fname" | awk -F"_" '{printf "Records will be restored as on... (1 Reply)
Discussion started by: milink
1 Replies

5. Shell Programming and Scripting

Date and time difference

I have start and finish date in the following format - Start Date: 5/21/2010 9:14:00 AM End Date : 5/24/2010 7:23:00 AM I need to get the time difference in the following format :mm or . Any help would be really appreciated. Thank you! (3 Replies)
Discussion started by: randev
3 Replies

6. Shell Programming and Scripting

Date / Time difference in shell script

================================================================================ Request ID GMDCOM TIME GMDRRS TIME COM-RRS ================================================================================ <36812974> Tue Oct 1 13:32:40 2013 Tue Oct 1 20:36:42 2013... (1 Reply)
Discussion started by: ghosh_tanmoy
1 Replies

7. Shell Programming and Scripting

Date / Time difference in shell script

Request ID GMDCOMTM GMDRRSTIME GMDRESTIME <36812986> : : :I want to display the date -time difference in other fields. Above I have given for only 1 record. I want to calculate for all the records. (GMCOMTM - GMDRRSTM) ,(GMDRRSTM-GMDRESTM) and... (5 Replies)
Discussion started by: ghosh_tanmoy
5 Replies

8. Shell Programming and Scripting

Date time difference in UNIX shell script

There are 2 dates, Tue Oct 1 13:40:19 2013 Sun Sept 30 10:26:23 2013 I have multiple dates like the above one. How do I calculate the date time difference and display in another column in Shell script. Please help. (3 Replies)
Discussion started by: tanmoysays
3 Replies

9. AIX

Time Difference between date and date -u

Hi Everyone, We are having an issue with date and date -u in our AIX Systems. We have checked environment variable TZ and /etc/environment and however, we could not rectify the difference. >date Thu Mar 19 22:31:40 IST 2015 >date -u Thu Mar 19 17:01:44 GMT 2015 Any clue... (5 Replies)
Discussion started by: madhav.kunapa
5 Replies

10. UNIX for Beginners Questions & Answers

In HP-UX how to find the date time difference ?

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
APC_CACHE_INFO(3)							 1							 APC_CACHE_INFO(3)

apc_cache_info - Retrieves cached information from APC's data store

SYNOPSIS
array apc_cache_info ([string $cache_type = ""], [bool $limited = false]) DESCRIPTION
Retrieves cached information and meta-data from APC's data store. PARAMETERS
o $cache_type - If $cache_type is " user", information about the user cache will be returned. If $cache_type is " filehits", information about which files have been served from the bytecode cache for the current request will be returned. This feature must be enabled at compile time using --enable-filehits. If an invalid or no $cache_type is specified, information about the system cache (cached files) will be returned. o $limited - If $limited is TRUE, the return value will exclude the individual list of cache entries. This is useful when trying to optimize calls for statistics gathering. RETURN VALUES
Array of cached data (and meta-data) or FALSE on failure Note apc_cache_info(3) will raise a warning if it is unable to retrieve APC cache data. This typically occurs when APC is not enabled. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ |3.0.11 | | | | | | | The $limited parameter was introduced. | | | | |3.0.16 | | | | | | | The " filehits" option for the $cache_type | | | parameter was introduced. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 A apc_cache_info(3) example <?php print_r(apc_cache_info()); ?> The above example will output something similar to: Array ( [num_slots] => 2000 [ttl] => 0 [num_hits] => 9 [num_misses] => 3 [start_time] => 1123958803 [cache_list] => Array ( [0] => Array ( [filename] => /path/to/apc_test.php [device] => 29954 [inode] => 1130511 [type] => file [num_hits] => 1 [mtime] => 1123960686 [creation_time] => 1123960696 [deletion_time] => 0 [access_time] => 1123962864 [ref_count] => 1 [mem_size] => 677 ) [1] => Array (...iterates for each cached file) ) SEE ALSO
APC configuration directives, APCIterator::getTotalSize, APCIterator::getTotalHits, APCIterator::getTotalCount. PHP Documentation Group APC_CACHE_INFO(3)
All times are GMT -4. The time now is 07:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy