Sponsored Content
Full Discussion: comparing time stamps
Top Forums Shell Programming and Scripting comparing time stamps Post 302336353 by RSC1985 on Wednesday 22nd of July 2009 01:06:55 AM
Old 07-22-2009
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?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copying Files in the same order along with time stamps

Hi , I am New to this group and would like to know if someone can help me on this issue : We need to copy some files from a particular directory to another directory in the same order and time stamps .How can this be achieved . For Ex : ./ABC/disk101/XYZ has 1000 files with varying... (2 Replies)
Discussion started by: shyam.appalla
2 Replies

2. UNIX for Dummies Questions & Answers

List files with date and time stamps only

Hi there, I'm using terminal on mac and using the ls -l command to list all the files in a directory. However, I only want to display the date and time stamp of each file rather than permissions, owner, group etc... Is this possible? Many thanks in advance Dave (2 Replies)
Discussion started by: davewg
2 Replies

3. UNIX for Dummies Questions & Answers

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... (1 Reply)
Discussion started by: RSC1985
1 Replies

4. Shell Programming and Scripting

Time difference between two time stamps

Hi Friends, I have 2 varaibles which contain START=`date '+ %m/%d/%y %H:%M:%S'` END=`date '+ %m/%d/%y %H:%M:%S'` i want the time difference between the two variables in Seconds. Plz help. (2 Replies)
Discussion started by: i150371485
2 Replies

5. Shell Programming and Scripting

date time stamps in bash

I'm looking for a way to have the "date" command output the date in a specific format. I'm not familiar with the different ways to use the date command at all. i read up on it, but i dont get how to manipulate it. i know that i can get the date format to give me a format like: 2012-10-13... (6 Replies)
Discussion started by: SkySmart
6 Replies

6. Shell Programming and Scripting

Increment time stamps.

Hi Gents. Please can you help me to solve a problem. I have a long list of files, which I need to change the time stamp. -r--r--r-- 1 geo2 geovect 47096216 Feb 8 10:40 00000009.segd -r--r--r-- 1 geo2 geovect 47096216 Feb 8 10:40 00000010.segd -r--r--r-- 1 geo2 geovect 47096216 Feb ... (11 Replies)
Discussion started by: jiam912
11 Replies

7. Shell Programming and Scripting

How to get the Logs between two Time Stamps?

Hi, I have been working on the error Log script, where errors are pulled from server. I need to pull the data of the error logs between two dates & time, for example : 22/12/2014 20:00:00 22/12/2014 22:00:00 Whatever error have came during this duration. Now the question is the record... (6 Replies)
Discussion started by: amitgpta90
6 Replies

8. Shell Programming and Scripting

Collecting logs between two time stamps

Hi, please help me to collect the entire log files between two time stamp. for example, I am looking script to collect the entire log between "2015-03-27 15:59" to "2015-03-27 16:15" in the below sample log file. OS : RHEL 6.3 Date/Time : 24 hours format, the time is printing each log... (12 Replies)
Discussion started by: jerryknj
12 Replies

9. Shell Programming and Scripting

Controlling time stamps in a bash script

Hi, I have a bash script that generates CSV (.txt) files at fairly regular time intervals. I'm currently time stamping each batch of measurements at the time I write the rows into a MySQL database. As the result, one set of data might get the time 12:01:32 and the next set of data gets the time... (18 Replies)
Discussion started by: Zooma
18 Replies

10. Windows & DOS: Issues & Discussions

Cygwin_openssh time stamps

I've installed cygwin_openssh on Windows 2012 R2 and it's working great. My issue is when a file is uploaded say from a different timezone, when it is uploaded, it doesnt pick up the sftp servers time.. Is there a way to fix that? i.e. When someone in PST uploads a file to this server in EST,... (0 Replies)
Discussion started by: MikeAdkins
0 Replies
utc(1m) 																   utc(1m)

NAME
utc - A dcecp object that manipulates UTC timestamps SYNOPSIS
utc add timestamp relative_timestamp utc compare absolute_timestamp absolute_timestamp [-noinaccuracy] utc convert absolute_timestamp [-gmt] utc help [operation | -verbose] utc multiply relative_timestamp {integer | floating_point_factor} utc operations utc subtract timestamp timestamp ARGUMENTS
An International Organization for Standardization (ISO) compliant time format of the following form: CCYY-MMDD- hh:mm:ss.fff[+|-]hh:mmIsss.fff The Time Differential Factor (TDF) component [+|-]hh.mm, if present, indicates the offset from Universal Time Coordinated (UTC) time and implies local system time. The inaccuracy component Iss.fff, if present, specifies the duration of the time interval that contains the absolute time. A floating-point number such as 53.234. A whole number such as 79. The name of the utc operation for which to display help information. A Distributed Time Service (DTS) timestamp of the following form: [-]DD-hh:mm:ss.fff- Iss.fff Relative times often omit fractions of seconds (the leftmost .fff sequence) and generally lack an inaccuracy component (Iss.fff). For example, a relative time of 21 days, 8 hours, and 15 minutes is expressed as 21-08:15:00. A utc timestamp that can be a relative or absolute time. See the relative_timestamp and absolute_timestamp argument descriptions for the format of these timestamps. DESCRIPTION
The utc object lets you add, compare, and convert timestamps in DTS and ISO formats. OPERATIONS
utc add Adds two timestamps. The syntax is as follows: utc add timestamp relative_timestamp The add operation returns the sum of two timestamps. The timestamps can be two relative times or an absolute time and a relative time. Privileges Required No special privileges are needed to use the utc add command. Examples dcecp> utc add 1994-10-18-13:21:50.419-04:00I----- +0-00:02:00.000I----- 1994-10-18-13:23:50.419-04:00I----- dcecp> utc compare Compares two absolute timestamps indicating the temporal order. The syntax is as follows: utc compare absolute_timestamp absolute_time- stamp [-noinaccuracy] The compare operation compares two timestamps and returns -1 if the first is earlier, 1 if the second is earlier, and 0 if the difference is indeterminate. Specify the -noinaccuracy option to ignore inaccuracies in comparisons; in this case a return of 0 indicates the times are the same. Privileges Required No special privileges are needed to use the utc compare command. Examples dcecp> utc compare 1994-10-18-13:22:32.816-04:00I----- > 1994-10-18-13:21:50.419-04:00I----- -noinaccuracy 1 dcecp> utc convert Converts a timestamp from UTC to local time. The syntax is as follows: utc convert absolute_timestamp [-gmt] The convert operation accepts a timestamp and returns another timestamp that expresses the same time in the local time zone. If called with the -gmt option it returns a Greenwich mean time (GMT) formatted timestamp. Privileges Required No special privileges are needed to use the utc convert command. Examples dcecp> utc convert 1994-10-18-13:22:32.816-00:00I----- 1994-10-18-09:22:32.816-04:00I----- dcecp> dcecp> utc convert 1994-10-18-13:22:32.816-00:00I----- -gmt 1994-10-18-13:22:32.816I----- dcecp> utc help Returns help information about the utc object and its operations. The syntax is as follows: utc help [operation | -verbose] Options Displays information about the utc object. Used without an argument or option, the utc help command returns brief information about each utc operation. The optional operation argu- ment is the name of an operation about which you want detailed information. Alternatively, you can use the -verbose option for more detailed information about the utc object itself. Privileges Required No special privileges are needed to use the utc help command. Examples dcecp> utc help add Adds a relative and absolute, or two relative, timestamps. compare Compares two timestamps to determine which is earlier. convert Converts a timestamp into the local timezone or GMT. multiply Multiplies a relative timestamp by a number. subtract Returns the difference between two timestamps. help Prints a summary of command-line options. operations Returns a list of the valid operations for this command. dcecp> utc multiply Multiplies a relative time (a length of time) by an integer or floating-point factor. The syntax is as follows: utc multiply rela- tive_timestamp {integer | floating_point_factor} The multiply operation accepts two arguments: a relative timestamp and an integer or floating-point factor. It multiplies the length of time (specified by the relative timestamp) by the integer or floating-point factor, returning the product as a relative timestamp. Privileges Required No special privileges are needed to use the utc multiply command. Examples dcecp> utc multiply +0-00:00:05.000I----- 3 +0-00:00:15.000I----- dcecp> utc operations Returns a list of the operations supported by the utc object. The syntax is as follows: utc operations The list of available operations is in alphabetical order except for help and operations, which are listed last. Privileges Required No special privileges are needed to use the utc operations command. Examples dcecp> utc operations add compare convert multiply subtract help operations dcecp> utc subtract Subtracts one timestamp from another, returning the difference as a relative timestamp. The syntax is as follows: utc subtract timestamp timestamp The subtract operation returns the difference between two timestamps that express either an absolute time and a relative time, two relative times, or two absolute times. Subtracting an absolute timestamp from a relative timestamp, however, is not allowed. The return value is an absolute or relative timestamp, depending on how the command is used. Privileges Required No special privileges are needed to use the utc subtract command. Examples dcecp> utc subtract 1994-10-18-13:22:32.816-00:00I----- +0-00:00:15.000I----- 1994-10-18-13:22:17.816+00:00I----- dcecp> RELATED INFORMATION
Commands: dcecp(1m), dcecp_clock(1m), dcecp_dts(1m), dtsd(1m). utc(1m)
All times are GMT -4. The time now is 04:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy