Hello,
in a file are records of the following format:
----0---m---28.07.2007---23:13:18---rest---id=123456
----9---a---28.07.2007---23:13:46---rest---id=345677
----0---a---28.07.2007---23:13:57---rest---id=876543
By comparing the id's to the actual processing id (e.g. id=345677 ), I'd like to increase the counter
here from 9 to 10 and set the new timestamp.
By increasing the counter there is to notice that the new counter-value has 2 digits.
The record in the file should look after the processing like this:
---10---a---29.07.2007---13:32:46---rest---id=345677
What is the best way to do the whole processing ?
Here is my code for defining the actual timestamp
in a file are records of the following format:
----0---m---28.07.2007---23:13:18---rest---id=123456
----9---a---28.07.2007---23:13:46---rest---id=345677
----0---a---28.07.2007---23:13:57---rest---id=876543
By comparing the id's to the actual processing id (e.g. id=345677 ), I'd like to increase the counter
here from 9 to 10 and set the new timestamp.
By increasing the counter there is to notice that the new counter-value has 2 digits.
The record in the file should look after the processing like this:
---10---a---29.07.2007---13:32:46---rest---id=345677
What is the best way to do the whole processing ?
Here is my code for defining the actual timestamp
Code:
### timestamp##################################
( $sec ,$min ,$hour ,$mday ,$mon ,$year ) = localtime;
$jahr = 1900+$year;
if ( $mon <= 9 ) {$mon = "0"."$mon";}
if ( $mday <= 9 ) {$mday = "0"."$mday";}
if ( $sec <= 9 ) {$sec = "0"."$sec";}
if ( $min <= 9 ) {$min = "0"."$min";}
if ( $hour <= 9 ) {$hour = "0"."$hour";}
### ende timestamp##################################