Hi Petr,

thanks for your script, works fine here and solves the problem.


Thorsten M


-----Ursprungliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 28. Juni 2000 14:05
An: [EMAIL PROTECTED]
Betreff: [REBOL] Empty lines Re:


here's my general script for removal of undesired content from text files:

REBOL []

file: read/lines %some-file.txt
result: copy []

what-not: [
    empty? trim/all copy line
    found? find trim/all copy line "VAHANAVYR"
    found? find line "======="
    (to-char first line) = (to-char 12)
]

foreach line file [if not any bind what-not 'line [insert tail result line]]

write/lines %result.txt result

just modify what-not block, in your case:

what-not: [
    empty? trim/all copy line
]

HTH,

-pekr-

[EMAIL PROTECTED] wrote:

> Thanks for the suggestions, but parse/all as well as trim/lines leaves the
> file untouched. Perhaps i should give some more info on what i am trying
to
> to. I get my hosts file from the unix server, get rid of all additional
> information, so that only ip-adresses are left. They are standing one
beyond
> the other, but sometimes with an empty line between. I want to use this
> modified hosts-file as an input file for my app, which should read line by
> line and calls a function for each line being read.
>
> Thorsten M
>
> Hi all others,
>
> need to remove empty lines from a file so that there are no spaces between
> the entries. Tried out parse and trim, but both killed the listform of the
> file.
>
> Any ideas what could help?
>
> Thorsten M

Reply via email to