Dear all, I'm stuck on Solaris 9 bash (I believe is quite different from Linux system) trying to find a solution.
I have one file named like:
The script should compare the actual date with the one reported on the file name and then take an action if the differences is greater or lower then 1 minute. The structure is like this:
Could someone help me to calculate the difference in minute? Thanks!
The minutes of actual time:
You will have to find a way to choose the file name you want to extract the minutes (?)
but the idea:
Now its simple arithmetics, I let you deal with...
This reads as nonsense because any time matches this condition (except exactly equals). Please post representative examples and explain the problem you are trying to solve, not the problems with your solution.
Well, you're right. I'll try to explain better.
I have a log dir (contains statistical data) with many files like (120629-1750-TERZ81_AS_YTR.txt). These file are created every minute.
The script I coded just take the last log file with the following command:
... then it extract the statistical counters!
But, if for some reason the system doesn't create any statistical data, with the above command, I always take the last file, that in this case is the same as previous script execution. So the statistical data is, in this case, not correct because the script take old data.
Since the log is created every minute, and the script runs from crontab every minute, what I need to do, is compare the actual date with the date present on filename. The problem is that the file is created one minute before the actual date, that's why I need to subtract 1 minute to actual date.
So, in other words, I need to take the actual date/time subtracting 1 minute and compare with the date/time extracted from filename.
What I cannot do is subtracting 1 minute to the actual date!!!!
---------- Post updated 01-07-12 at 01:51 AM ---------- Previous update was 30-06-12 at 05:02 PM ----------
Hi, I've been trying to develop a script that performs the parsing of a log every 1 minute and then generating some statistics. I'm fairly new to programming and this is why I come to ask if I can lend a hand.
this is my log:
xxxx 16/04/2012 17:00:52 - xxxx714 - E234 - Time= 119 ms.... (8 Replies)
Anyone knows how to use AWK to achieve the following
Sun Feb 12 00:41:01-00:41:59 Success:2 Fail:2
Sun Feb 12 00:42:01-00:42:59 Success:1 Fail:2
Sun Feb 12 01:20:01-01:20:59 Success:1 Fail:2
Mon Feb 13 22:41:01-22:41:59 Success:1 Fail:1
log file:
Success
Success
Fail
Fail
... (9 Replies)
Hi Guys,
Anyone who knows how to compare the current date with the a file containing a date, say for example I have a file that looks like this:
Command was launched from partition 0.
------------------------------------------------
Executing command in server server6
Fri Dec 16... (7 Replies)
Hi,
I want to compare today's date(DDMMYYYY) with yesterday(DDMMYYYY) from system date,if (today month = yesterday month) then execute alter query else do nothing.
The above requirement i want in Shell script(KSH)...
Can any one please help me?
Double post, continued here. (0 Replies)
Hello Gurus,
We have a query where we need to add one minute ( also we need to add 12 hrs in another query) to given date.
we tried using some functionalities like 'perl -e @d= $run_dt + 600' . however we were not succeeded.
Basically issue is we get date in following format "May18... (9 Replies)
is there any ways to get the time difference between 2 dates in UNIX?
for example, For below date the outut should come 22 minutes
startdate enddate
========= =======
06/17/2008 13:25 06/17/2008 13:47
For, below date, the output should come 1462 minutes
... (5 Replies)
could you please find a solution for this:
I need to write a shell script which checks after every minute whether a friend has logged in or not.The script should report whether that person has logged in along with the amount of time the person was late in logging in.
I have no idea how to... (2 Replies)
Daily one file will dropped into this directory.
Directory: /opt/app/jt/drop
File name: XXXX_<timestamp>.dat.gz
I need to write a script which checks whether the file is dropped daily or not.
Any idea in the script how can we compare timestamp of the file to today's date?? (3 Replies)
I need to extract the date part from the file name (20080221 in this ex) and compare it with the current date and delete it, if it is a past date.
$file = exp_ABCD4_T-2584780_upto_20080221.dmp.Z
really appreciate any help.
thanks
mkneni (4 Replies)