Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

parsing question

 [1/6] from: biuro::terminal::sky::pl at: 19-Nov-2002 1:03


I have a tab-delimited file, and want to "reuse" it. Some cells have with enters in it, and looks like: bla bla bla bla to make it in one line i wrote: parse/all plik [ some [to {"} tu: (remove tu) to "^/" tu: (remove tu) to {"} tu: (remove tu)] to end ] everythings was fine - except lines like that: bla bla - went out, but new line remains I have tried some, but without succes. finally i wrote: parse/all plik [ some [to { } tu: (remove tu replace tu "^/" " ") to {"} tu: (remove tu)] to end ] it works, but is "hammerish". How can one do it? regards Alekk

 [2/6] from: jan:skibinski:sympatico:ca at: 19-Nov-2002 0:02


Hi Alekk, If I understand you correctly, you have a file with strings like this: {a b c d} and you wish to remove newlines, because otherwise output looks messy - something like this, correct? z: "a b c^/ d" If this is your problem then this simplest possible parser should work for you:
>> parse z none
== ["a" "b" "c" "d"] Regards, Jan . Terminal wrote:

 [3/6] from: chalz:earthlink at: 19-Nov-2002 0:00


I'm sorry, I'm not very skilled in parse and all; however, it strikes me that perhaps you could simply use a replace command? replace/all <source> #"^/" "" perhaps?

 [4/6] from: biuro:terminal:sky:pl at: 19-Nov-2002 11:48


----- Original Message ----- From: "Jan Skibinski" <[jan--skibinski--sympatico--ca]> To: <[rebol-list--rebol--com]> Sent: Tuesday, November 19, 2002 6:02 AM Subject: [REBOL] Re: parsing question
> Hi Alekk, > If I understand you correctly, you have a file with strings like this:
<<quoted lines omitted: 9>>
> Regards, > Jan
Not exactly - i have tab delimited file (saved from excell) and gennerally want to change from: {a^-b^-"asdfa^/adsfa"^-c} to {a^-b^-asdfaasdfa^-c} but for this {aaa^-b^-b^-"fasdfasdf^/"^-c} my "parser" parse/all plik [ some [to {"} tu: (remove tu) to "^/" tu: (remove tu) to {"} tu: (remove tu)] to end ] doesn't work - it makes {aaa^-b^-b^-fasdfasdf^/^-c} instead {aaa^-b^-b^-fasdfasdf^-c} so i wrote: parse/all plik [ some [to {"} tu: (remove tu replace tu "^/" " ") to {"} tu: (remove tu)] to end ] it works, but is (?) ugly. I've tried some combinations, but nothing work for me regards Alekk

 [5/6] from: jan:skibinski:sympatico:ca at: 19-Nov-2002 14:28


Alekk, I tried your first version of your rule on the sequence that troubles you: {aaa^-b^-b^-"fasdfasdf^/"^-c} and I got exactly what you wish for: == {aaa^-b^-b^-fasdfasdf^-c} My guess is that we might be running different Rebol versions. I just run that test on Core 2.5.2 (2502031.exe). [I downgraded from 2.5.3 to 2.5.2 after discovering some really troublesome problems with the former.] Regards, Jan

 [6/6] from: biuro:terminal:sky:pl at: 19-Nov-2002 23:25


> Alekk, > > I tried your first version of your rule on the sequence > that troubles you: {aaa^-b^-b^-"fasdfasdf^/"^-c} > and I got exactly what you wish for: > == {aaa^-b^-b^-fasdfasdf^-c}
Ups - it was my fault - there was some records which use #";" and therefore in quotes too... thanks for answer :-) regards Alekk

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted