![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with subtracting time stamps in excel.. | ks_reddy | UNIX for Dummies Questions & Answers | 1 | 04-15-2009 03:30 PM |
| Adding Date & time stamps to filename | manish.s | UNIX for Dummies Questions & Answers | 1 | 03-13-2009 04:00 AM |
| pERL SCRIPT FOR MONITORING DATE/TIME STAMPS FOR START AND STOP OF APPLICAION IN A LOG | FREDDIE091970 | Shell Programming and Scripting | 4 | 03-31-2008 10:59 PM |
| List files with date and time stamps only | davewg | UNIX for Dummies Questions & Answers | 2 | 01-14-2008 06:33 AM |
| Copying Files in the same order along with time stamps | shyam.appalla | Shell Programming and Scripting | 2 | 12-04-2005 10:44 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
comparing time stamps
Hello All,
I'm generating timestamps (file creation timestamps) for all the files in a directory. I need to compare all the timestamps. for example if i have 4 files and their timestamps are 20091125114556, 20091125114556,20091125114556,20091125114556 respectively. I need to differentiate atleast secs portion to recognize the file. So what i'm going to do is if all timestamps are same then i will modify seconds portion. But my question here is how to compare these timestamps respect to their corresponding files.? Please suggest a way but not the solution. Thanks in advance, RSC1985 |
|
||||
|
Search a bit, this has been answered before.
I will give you a hint how you can do this: 1. separte the YYYYMMDD and HHMISS parts 2. Compare the YYYYMMDD if they are same 3. compare HHMISS this way you can know whether the timestamps are same or not... rest is just the coding manipulation. |
|
||||
|
Can't I do direct comparison Because if i store into a variable the timestamp, I can directly do the comparison. But I'm struggling to store all these timestamps and next comparing all these timestamps one with the other.I should get how many are same and what are those so that i can go with my rest of the processing.If could give some more idea on this it would be really helpful.
|
|
||||
|
Below is the example.
I will get the timestamps(file modification time in the form YYYYMMDDHHMMSS) for all the files in the directory by the below code. for filename in `find . -type f -exec basename {} \;` do echo "The file name is $filename" timestamp=`../../tmp/getTime.pl $filename` echo "the timestamp of $filename is $timestamp" done Now I have to check for what are the files that have same timestamps. for example file1 has 20091225114556 timestamp and file3 has 20091225114556 timestamp and file4 has also 20091225114556 the same timestamp. My task is to modify these timestamps inorder to make them unique. So i need to modify the timestamp of file3 and file4 as 20091225114557 and 20091225114558. could you please give an idea how to proceed on this? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|