Re: Regex to extract numbers between "[ ]"
From: Chris Devers (cdevers_at_pobox.com)
Date: 02/18/05
- Next message: Harold Castro: "simple substitution question"
- Previous message: Harold Castro: "Regex to extract numbers between "[ ]""
- In reply to: Harold Castro: "Regex to extract numbers between "[ ]""
- Next in thread: Ing. Branislav Gerzo: "Re: Regex to extract numbers between "[ ]""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 18 Feb 2005 01:19:07 -0500 (EST) To: Harold Castro <b0ydaem0n@yahoo.com>
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
- Next message: Harold Castro: "simple substitution question"
- Previous message: Harold Castro: "Regex to extract numbers between "[ ]""
- In reply to: Harold Castro: "Regex to extract numbers between "[ ]""
- Next in thread: Ing. Branislav Gerzo: "Re: Regex to extract numbers between "[ ]""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|