[X-Unix] Question about grep

Brent Baisley brent at landover.com
Wed Mar 17 05:32:59 PST 2004


My first question is why would you want to keep years worth of backup 
logs?

Grep doesn't know about data types, so you really can't easily use grep 
to determine a date range. What you could do is just grep the end of 
the log since Retrospect writes to the end of the log. Something like:
tail -500 logfile | grep -v Successful

That will only process the last 500 lines of the file.

Long term you should set Retrospect to keep the log file small. If you 
need to keep a history, cycle out the log like most Unix logs are done. 
Your own computer does this everyday with various other logs. Import 
the log into Filemaker or MySQL to keep a long history and easy 
searching.

On Mar 16, 2004, at 7:02 PM, Our Pal Al wrote:

> So in a file with lots of lines like this -
>
> 3/15/2004    5:58 PM    Drogo-OS X (21.177)    Macintosh HD    -24001
> user canceled    0:34:00    129.85.21.177
>
> How can I formulate grep to grab on the mm/dd/yyyy field and pull out 
> "any
> lines where the date is no older than 7 days ago"?
>
-- 
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577



More information about the X-Unix mailing list