Hi Mikael,

one simple way to do it:

result: make block! 100

remove-these: [ 
  "get rid of this"
  "remove this"
]

foreach line read/lines %test.txt [
  foreach pattern remove-these [
    if found? find line pattern [clear line]
  ]
  if > length? line 0 [append/only result line]
]

Note that this implementation wil skip empty lines in the log file!

Using this example file - test.txt:
This is line 1 remove this
this is line 2
this is line 3 
this is line 4 remove this
this is line 5 get rid of this
this is line 6
this is line 7
this is line 8 get rid of this
this is line 9
this is line 10 remove this    


We get the following results:

>> foreach line result [print line]
this is line 2
this is line 3
this is line 6
this is line 7
this is line 9    



At 02:33 AM 11/29/99 +0100, you wrote:
>I've just started out with some REBOL programming and the first task I was
>planning to solve is this:
>
>I got a backup log that I want to filter out all rows that match a set of
>strings.
>
>1. Open a text file
>2. Compare every line with all strings. And if match delete row.
>3. Write file back to disk.
>
>I've got a little bit of code doing this with one match string today :-) But
>I'm not going to show you how I did :-) Ugly code... I believe.
>
>Thanks :-)
>
>--
> Mikael Östergren
> [EMAIL PROTECTED]
> mob: +46 (70) 555 4431
> fax: +46 (8) 5981 5932
> voice box: +46 (8) 5981 5932
>
>
>

Reply via email to