On Thu, 17 Feb 2005, Harold Castro wrote:

>   I'm parsing a log file that contains numbers
> enclosed by []. Ex. [1108702375]
> I need to extract them so that I can convert them to
> `date -r` format.
> 
> Any help is apreciated.

Please show us the code you've tried so far.

Also, please explain what `date -r` does on your system. On my computer 
it doesn't seem to work as a standalone command, though it does with an 
argument. Is this the same as what you see?

    $ date -r
    date: option requires an argument -- r
    usage: date [-nu] [-r seconds] [+format]
           date [[[[[cc]yy]mm]dd]hh]mm[.ss]
    $ date -r 0
    Wed Dec 31 19:00:00 EST 1969
    $ date -r 1108702375
    Thu Feb 17 23:52:55 EST 2005
    $

You can get something very close to that last format this way:

    $ perl -le 'print scalar localtime 1108702375'
    Thu Feb 17 23:52:55 2005
    $

But if you need an exact match, the statement is a bit more complex.

Please show the code you've written so far for extracting the number and 
we can help you plug things together. 



-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to