This solution matches a pattern anywhere in each line, uses 'remove, and
doesn't require two lists:
(alternatively 'data could just as well be: data: read/lines %blaah.txt)

>> data: ["asgnertiue" "fdyiaref" "ipfttremsert" "aqwsedfbnkmuip;"
"stremunrtity" "serybrtyaw"]
== ["asgnertiue" "fdyiaref" "ipfttremsert" "aqwsedfbnkmuip;" "stremunrtity"
"serybrtyaw"]

>> while [not tail? data] [
>>      either find first data "rem" [print first data remove data][data:
next data]
>> ]
ipfttremsert
stremunrtity

>> print mold head data
["asgnertiue" "fdyiaref" "aqwsedfbnkmuip;" "serybrtyaw"]

- Michael Jelinek

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 13, 2000 11:32 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] Removing lines... Re:


[EMAIL PROTECTED] wrote:
> 
> Hi list,
> I've read a textfile with read/lines....is there an easy way to remove
> a line from the data?
> 
> it goes something like:
> 
> data: read/lines %blaah.txt
> 
> if find data "plupp" [remove the line] <--- of course there oughta be
> some easy code there.. ;)

This isn't the best solution but I can't seem to get 'remove to do it...

data: read/lines %blaah.txt
out-data: []
foreach line data [if not find line "plupp" [append out-data line]]

Then 'out-data should contain 'data without the offending lines.

- Chris

Reply via email to