Sponsored Content
Top Forums Shell Programming and Scripting Date comparison in file to system time Post 302293805 by zainravi on Wednesday 4th of March 2009 12:11:06 AM
Old 03-04-2009
Date comparison in file to system time

I have a CSV (comma separated vaule) file whose entries resemble

Code:
Area,\\ntsvsp02\vmcs\download\files\Areas.dat,1,20090303,0,Import Complete,2009-03-02 04:23:00
Product,\\ntsvsp02\vmcs\download\files\items.dat,1,20090303,0,Import Complete,2009-03-02 04:23:00
Store,\\ntsvsp02\vmcs\download\files\Stores.dat,1,20090303,0,Import Complete,2009-03-02 04:25:00
Region,\\ntsvsp02\vmcs\download\files\Regions.dat,1,20090303,0,Import Complete,2009-03-02 04:25:00
LineList,\\ntsvsp02\vmcs\download\files\linelist.dat,1,20090301,0,Import Complete,2009-03-01 06:27:00

Code:
RangingDates,1,20090302,20090303,17,0,Export Complete,2009-03-01 19:54:00
FutureModuleList,1,20090302,20090303,6,0,Export Complete,2009-03-01 06:00:00
StoreDescription,1,20090303,20090304,5,0,Export Complete,2009-03-02 05:00:00
StoreToDisplay,1,20090303,20090304,5,0,Export Complete,2009-03-02 05:18:00
FutureStoreToDisplay,1,20090302,20090303,6,0,Export Complete,2009-03-01 06:05:00
FutureStoreDescription,1,20090302,20090303,6,0,Export Complete,2009-03-01 06:06:00
Module,1,20090302,20090303,15,0,Export Complete,2009-03-01 15:00:00
ModuleDispOpt,1,20090302,20090303,15,0,Export Complete,2009-03-01 15:01:00
DispOptProduct,1,20090302,20090303,14,0,Export Complete,2009-03-01 15:10:00
StoreDispOpt,1,20090302,20090303,15,0,Export Complete,2009-03-01 15:13:00
StoreItem,1,20090302,20090303,13,0,Export Complete,2009-03-01 14:06:00


I need to a command (I think awk could be helpful?) which will scan the last column (i.e. the date and time) and set a variable called TIME_EXCEEDED to one (1) i.e. TIME_EXCEEDED=1 if the if they (any one of the last column entry) are older than 24 hours (when being compared to the system time).

Please let me know if the above information was helpful
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

File Time Comparison Question

I want a cron job to fire off every 5 minutes or so to verify that a file in a directory is not more than 15 minutes old (from the current time. If the newest file is more than 15 minutes old, I would fire off an email.. The email part is easy, but I'm having trouble figuring the logic... (2 Replies)
Discussion started by: pc9456
2 Replies

2. Shell Programming and Scripting

Processing a log file based on date/time input and the date/time on the log file

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)
Discussion started by: primp
4 Replies

3. Shell Programming and Scripting

System time comparison to fixed defined time

I have a requirement of checking the current system time and performing certain actions in a shell script. example: if the current system time is greater than 1400 hrs, then perform step 1,2,3 if the current system time is greater than 1000 hrs, then perform step 1,2 if the current system time... (2 Replies)
Discussion started by: zainravi
2 Replies

4. Shell Programming and Scripting

Removing rows from a file based on date comparison

I have a '|' delimited file and want to remove all the records from the file if the date is greater than a year from sysdate. The layout of the file is as below - xxxxxxxxxxxxxx|yyyyyy|zzzzzz|2009-12-27-00:00| 000000000|N xxxxxxxxxxxxxx|yyyyyy|zzzzzz|2010-01-03-00:00| 000000000|N... (4 Replies)
Discussion started by: Max_2503
4 Replies

5. Homework & Coursework Questions

Date comparison with 'string date having slashes and time zone' in Bash only

1. The problem statement, all variables and given/known data: I have standard web server log file. It contains different columns (like IP address, request result code, request type etc) including a date column with the format . I have developed a log analysis command line utility that displays... (1 Reply)
Discussion started by: TariqYousaf
1 Replies

6. Shell Programming and Scripting

File modification time comparison

Hi All, I have two files (given below) each exists under different paths. I want to compare the modification time stamp of file1.txt is lessthan the modification time of file2.txt. month1=`ls -l file1.txt | awk '{ print $6}'` date1=`ls -file1.txt | awk '{ print $7}'` time1=`ls... (1 Reply)
Discussion started by: Arunprasad
1 Replies

7. Shell Programming and Scripting

append a filename with system date and time

Hi, There are similar kind of posts, but none seems like working for me. Please correct me if I'm wrong. I need append/rename file abc.txt with file processed date and time like abc_systemdatetimestamp.txt and move it to different folder. for example I have /source/data/abc.txt ... (1 Reply)
Discussion started by: amsn08
1 Replies

8. Shell Programming and Scripting

Date and Time comparison using shell script

Hi, I'm having two fields in the file F1|F2 20111220|102000 F1 ->YYYYMMDD F2 ->HHMMSS Now, I need to compare this with current date & time and need to return the difference value in hours. Already, I checked with datecalc from the forum. So, need hints from Shell Gurus. Thanks (10 Replies)
Discussion started by: buzzusa
10 Replies

9. Shell Programming and Scripting

[Solved] How to tar data along with current system date and time.?

Hi all, Following is my small script:- #!/bin/ksh for i in `cat /users/jack/mainfile-dr.txt` do sudo cp -r $i /users/jack/DR01/. done cd /users/jack/DR01/ sudo tar cvf system1-DR.tar * scp system1-DR.tar backupserver:/DRFiles/system1 sudo rm -rf system1-DR.tar In this script I... (10 Replies)
Discussion started by: manalisharmabe
10 Replies

10. SCO

Cannot use 'date -t' to set the system date and time

Hi! All, I am trying to reset the date and time since the change in time over the weekend. I cannot issue the command date -t 201703131330. The system gives me an error invalid option. This happens on my SCO OpenServer 5.0.7 and 5.0.6. Do anyone have an idea why? I even tried using... (6 Replies)
Discussion started by: trolley
6 Replies
XtSetSensitive(3Xt)						     MIT X11R4						       XtSetSensitive(3Xt)

Name
       XtSetSensitive, XtIsSensitive - set and check a widget's sensitivity state

Syntax
       void XtSetSensitive(w, sensitive)
	  Widget w;
	  Boolean sensitive;

       Boolean XtIsSensitive(w)
	  Widget w;

Arguments
       sensitive Specifies a Boolean value that indicates whether the widget should receive keyboard and pointer events.

       w	 Specifies the widget.

Description
       The function first calls on the current widget with an argument list specifying that the sensitive field should change to the new value.
       It then recursively propagates the new value down the managed children tree by calling on each child to set the ancestor_sensitive to the
       new value if the new values for sensitive and the child's ancestor_sensitive are not the same.

       calls to change sensitive and ancestor_sensitive.  Therefore, when one of these changes, the widget's set_values procedure should take
       whatever display actions are needed (for example, greying out or stippling the widget).

       maintains the invariant that if parent has either sensitive or ancestor_sensitive then all children have ancestor_sensitive

       The function returns or to indicate whether or not user input events are being dispatched.  If both core.sensitive and core.ancestor_sensi-
       tive are returns otherwise, it returns

See Also
       X Window System Toolkit: The Complete Programmer's Guide and Specification, Paul J. Asente and Ralph Swick
       X Window System: The Complete Reference, Second Edition, Robert W. Scheifler and James Gettys

															       XtSetSensitive(3Xt)
All times are GMT -4. The time now is 09:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy