|
Pages: [1]
|
 |
|
Author
|
Topic: Parse Help (Read 230 times)
|
|
jcale4
|
Please bear with me as today is my first day using Rebol
I have a file that i export daily and add a .DEL extension (to satisfy DB2). This file has the following dilemiters:
column delim: ~ character delim: {
here is a small section of one line of the file:
99~{text{~3882~{Info for product number{
I need to be able to parse this file and remove the extra spaces between each word in the last column. I think i know how to actually do the parsing, using "skip" to get to the 4th column and replacing spaces... my problem is that i'm not sure how i create the new, "fixed" file. Can anyone help me with this?
Thank you!!!
|
|
|
|
|
Logged
|
|
|
|
|
jcale4
|
 |
Parse Help
« Reply #1 on: April 27, 2005, 10:38:00 AM » |
|
Sorry, forgot that posts are trimmed. In the example:
99~{text{~3882~{Info for product number{
The column - "Info for product number" has several spaces between each word.
|
|
|
|
|
Logged
|
|
|
|
aRebol
Guest
|
 |
Parse Help
« Reply #2 on: April 28, 2005, 04:34:20 AM » |
|
rebol [] input: read/lines %/d/program-sources/rebol/test/input.txt foreach line input [ parse/all line [3 [thru "{"] begin: copy spacy to "{" end: to end] remove/part skip line ((index? begin) - 1) ((index? end) - (index? begin)) insert at line (index? begin) trim/all spacy ] write/lines %/d/program-sources/rebol/test/output.txt input
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |