| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | binktrim in rebol |
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)SEEN-BY: 633/267 270 @PATH: 249/100 261/38 123/500 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.