giberisk
asked on
Text file formatting
Hello
I have the attached text file that I would like to reformat.
I am only interested to work with the time, the data after the time can be dumped.
The script must calculate the time between each entry.
The file must look like this after processing :
00:10:32 ( 00:04:13 )
00:14:45 ( 00:00:45 )
00:15:30 ( next time.... )
As you can see, I have added the time between the entries.
e.g : 00:04:13 represents the time that passed between 00:10:32 and 00:14:45
Thank you in advance !
I have the attached text file that I would like to reformat.
I am only interested to work with the time, the data after the time can be dumped.
The script must calculate the time between each entry.
The file must look like this after processing :
00:10:32 ( 00:04:13 )
00:14:45 ( 00:00:45 )
00:15:30 ( next time.... )
As you can see, I have added the time between the entries.
e.g : 00:04:13 represents the time that passed between 00:10:32 and 00:14:45
Thank you in advance !
00:10:32 - 342333
00:14:23 - 2343242394809848754533
00:15:34 - 908942859445345435345345345
Can the times ever wrap around midnight?
Does this have to be a BAT solution, or would VB script be okay (a little easier to do the calculations there)?
~bp
Does this have to be a BAT solution, or would VB script be okay (a little easier to do the calculations there)?
~bp
ASKER
Yes sir,. vb script would be perfect!
ASKER
Also C# .NET is ok, I can work with that too
ASKER
The time will never be 00:00:00 , if this is your concern
Just a thought, would it be acceptable to do the following, rather than what you proposed? I'm basically suggesting that you write on line n the difference in time from line n-1 to line n. This would be a little cleaner to implement, since you could read line n and write it's value without having to read line n+1 first as you proposed. So the result would be:
00:10:32 ( 00:00:00 )
00:14:45 ( 00:04:13 )
00:15:30 ( 00:00:45 )
~bp
00:10:32 ( 00:00:00 )
00:14:45 ( 00:04:13 )
00:15:30 ( 00:00:45 )
~bp
ASKER
Of course, this would be great !
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hey
I have solved the problem in excel.
But i will accept your solution anyway, thank you for your time
I have solved the problem in excel.
But i will accept your solution anyway, thank you for your time
Welcome.
~bp
~bp
http://www.dostips.com/DtTipsStringManipulation.php
To calculate the difference, you'll need to extract the time in hour, minutes and seconds. Convert to all seconds, do your math, then convert back to time format
I found an example here. http://forums.techguy.org/software-development/757804-calculating-time-differences-batch-script.html