Peter
Sorry, for the mess.
It means last argument in Time.#local.
Time#strftime is so you say.
Peter
Sorry, for the mess.
It means last argument in Time.#local.
Time#strftime is so you say.
hmm interesting
3 of the logs have the month as 1 instead of 01 and it does not get seen
as in range.
What are you doing here time = “#{$2}/#{$1}#{$3}” ?
In order to catch these logs I’m thinking I should drop the date
completely from this part of the scan because the logs are generated
daily do I can just search the date.log for the proper time.
On Sun, Jan 22, 2012 at 4:27 AM, Kenichi K. [email protected]
wrote:
Peter
Sorry, for the mess.
It means last argument in Time.#local.
Time#strftime is so you say.
No prob
Peter
On Mon, Jan 23, 2012 at 6:26 PM, Christopher G.
[email protected]wrote:
hmm interesting
3 of the logs have the month as 1 instead of 01 and it does not get seen
as in range.
The regexp that I proposed now:
/^(\d{2}/\d{2})/(\d{4})(\s\d{1,2}:\d{2}:\d{2}:\d{1,3})/
will indeed only work on a month like ‘01’ , ‘12’, …
That is because the {2} required exactly 2 digits.
If you also want to match ‘1’, ‘5’ etc. you may need to write
/^(\d{1,2}/\d{2})/(\d{4})(\s\d{1,2}:\d{2}:\d{2}:\d{1,3})/
But then … for a string comparison, you will need to
expand it always to a 2 character result (otherwise
the month ‘5’ would be “higher” than the month ‘10’;
but ‘05’ is lower than ‘10’).
What are you doing here time = “#{$2}/#{$1}#{$3}” ?
There are 3 groups in the regex (between the brackets) and
I am reordering them to generate the YYYY/mm/dd HH:MM:SS:MMM
format.
I think UNTESTED !! the new regexp then becomes:
/^(\d{1,2})/(\d{1,2})/(\d{4})(\s\d{1,2}:\d{2}:\d{2}:\d{1,3})/
^ GRP 1 ^ ^ GRP 2 ^ ^ GRP3^^ GROUP 4 ^
and
time = “#{$3}/#{$1.rjust(2,‘0’)}/#{$2.rjust(2,‘0’)}#{$4}”
The GRP comments are to show you the extent of the 4 Regex groups, that
you find back then as $1, $2, $3, $4.
In order to catch these logs I’m thinking I should drop the date
completely from this part of the scan because the logs are generated
daily do I can just search the date.log for the proper time.
That 's also a possibility
Pete
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs