Subj : binktrim in rebol To : All From : tony summerfelt Date : Tue Mar 30 2004 03:14 pm here's the (mostly) same binkd.log trimming program in rebol. the main advantage is that there's not much code, and is very light on resources (less than 270k on windows for rebol and the script) it's probably slightly less code than the tcl/tk version (definitely less than perl and ruby, or python) one thing you learn pretty quick with rebol is that it takes very few lines to do useful things. there's a few disadvantages: - it's not the quickest (i think perl has them all beat for file/string maniuplation - it took me LONG time to write, because the rebol documentation sucks (oh, there's tons of docs, but they all suck. badly) every single line of code i wrote was gleaned from what other people had written as that's the only place to get real examples. as it is, i think i'd have a hard time explain what some of those lines do without thinking first. this is the minimal amount of code that will do the job. by rights rebol [] should be filled in. and i haven't figured out how to do command line arguments yet :) ========================================================================== REBOL [] binkd-log: read/lines %binkd.log days: 2 forall binkd-log [ line: first binkd-log line: parse/all line " " date: pick line 2 if date <> none [ month: pick line 3 time: pick line 4 date-time: join date ["-" month "-" now/year "/" time now/zone] date-time: to-date date-time line: rejoin [form line newline] if (now - date-time) < days [write/append %binkd.trimmed line] ] ] trimmed-log: read %binkd.trimmed write %binkd.log trimmed-log if exists? %binkd.trimmed [delete %binkd.trimmed] ========================================================================== --- GoldED/spleen 3.0.1+ * Origin: ventedspleen.dyndns.org (1:249/100) .