Hello Peter:
I use a lot of tab delimited data-bases also. Data that is exported from
MS-Excel...
To parse out the individual lines of a database, I use something like the
following.
REBOL [
Title: "Example of parsing tab delimited records...."
]
; first gather up all the lines or records of data into a series called cases
cases: read/lines from-file
; now we will process each of the records one by one
foreach case cases [
items: parse/all case {^(tab)} ; parse the fields by seperating each
field wherever there is a tab
; now each item is a field from the database/record
o-case: make object! [
site-name: ticket: first-name: last-name: none
]
print items/1
print items/2
o-case/site-name: items/1
o-case/ticket: items/2
o-case/first-name: items/3
o-case/last-name: items/4
]
Another questions - where did that data format come from??
Does your data really already have brackets [ ] around each word?
You can make databases very easily in REBOL by storing all your values in
blocks.
For example:
[firstname lastname %filename ]
See the examples at http://www.rebol.com
From: [EMAIL PROTECTED] on 10/13/99 02:52 PM GMT
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc: (bcc: Doug Vos)
Subject: [REBOL] Newbie question
Hello!
I have just started to use Rebol and it seems to be a very
powerful language.
I have a problem that I hope someone can help me solve.
I have an ASCII database which looks like this:
[FIELD 1] [FIELD 2] [FIELD 3]
...
[FIELD 1] [FIELD 2] [FIELD 3]
Each field is included in [] and separated by a TAB character.
I would then like to read this file and parse the contents and
put it in a list of lists like.
List 1: LINE1->LINE2->...->LINEX
List 2: FIELD1->FIELD2->FIELD3
Each entry in the first list should point to a list
of the second type.
I hope this explanation makes sense...
Best Regards,
Peter Carlsson
----------------------------------------------------------------
Peter Carlsson Tel: +46 31 735 45 26
Saab Ericsson Space AB Fax: +46 31 735 40 00
S-405 15 G
�teborg Email: [EMAIL PROTECTED]
SWEDEN URL: http://www.space.se
----------------------------------------------------------------