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

### 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";} ### end timestamp##################################

In reply to process record in file by hudo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.