in reply to grep for last 45 days
Well, looking at the code you've provided showing what you've tried so far . . .
Oh, you didn't. Never mind.
Read the line. Extract the timestamp. Parse the timestamp (see Date::Manip, Date::Calc). Compare with now. Print if it's within your window.
Update:
require 'time' now=Time.now ARGF.each do |line| next unless line =~ /(.*?) : Depth/ d_days = ( now - Time.parse( $1 ) ) / 86400 puts line if d_days < 45 end
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: grep for last 45 days
by crashtest (Curate) on Mar 13, 2005 at 05:17 UTC | |
by Fletch (Bishop) on Mar 13, 2005 at 13:01 UTC | |
|
Re^2: grep for last 45 days
by Anonymous Monk on Mar 14, 2005 at 03:04 UTC | |
|
Re^2: grep for last 45 days
by Anonymous Monk on Mar 13, 2005 at 00:39 UTC |