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

SAVE each elements to a new line

 [1/4] from: info::id-net::ch at: 10-Aug-2002 9:45


Hey, is it possible to save each elements to a new line ? Here's an example. holiday.txt is : ["1" "2-Sept-2002"] ["2" "23-Sept-2002"] the rebol script is rebol [] a: load %holiday.txt append/only a ["3" "29-Sept-2002"] save %holiday.txt a The result is : ["1" "2-Sept-2002"] ["2" "23-Sept-2002"]["3" "29-Sept-2002"] instead of ["1" "2-Sept-2002"] ["2" "23-Sept-2002"] ["3" "29-Sept-2002"] Notes: I want to use load and save, not write/append/lines Phil

 [2/4] from: carl:cybercraft at: 10-Aug-2002 21:15


On 10-Aug-02, Philippe Oehler wrote:
> Hey, > is it possible to save each elements to a new line ?
<<quoted lines omitted: 15>>
> ["3" "29-Sept-2002"] > Notes: I want to use load and save, not write/append/lines
Using... append/only a load join "^/" mold ["3" "29-Sept-2002"] would do what you want (I think) but it's not too nice, as the block's converted to a string and then back again before it's appended. Formatting blocks has been discussed a bit before and I don't think any perfect answer was found. -- Carl Read

 [3/4] from: al:bri:xtra at: 10-Aug-2002 21:59


Phil asked:
> Is it possible to save each elements to a new line ?
Yes. Here's how:
>> write %Holiday.txt {[1 23/Sep/2002] ; First the original file...
{ [2 12/Aug/2002]}
>> x: load %Holiday.txt
== [[1 23-Sep-2002] [2 12-Aug-2002] ]
>> append x [ ; note the extra square bracket and lack of /only
refinement. [ [3 25/Dec/2002]] == [[1 23-Sep-2002] [2 12-Aug-2002] [3 25-Dec-2002] ]
>> save %Holiday.txt x >> print read %Holiday.txt
[1 23-Sep-2002] [2 12-Aug-2002] [3 25-Dec-2002] Ta dah! :) Andrew Martin Rebolutionary in full dress uniform... ICQ: 26227169 http://valley.150m.com/

 [4/4] from: jjmmes:ya:hoo:es at: 13-Aug-2002 17:59


Hi Andrew: I wonder how you do this when you have a block variable: new-block: compose/deep [ [(block-var)]] append x new-block What am I missing ? Thanks

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