Replace Text in Lines

Michael D. dweeble at wi.rr.com
Tue Jan 9 21:48:26 EST 2007


Klaus,
Thanks this works just perfect , and a good one for me to remember.
Michael

----- Original Message ----- 
From: "Klaus Major" <klaus at major-k.de>
To: "How to use Revolution" <use-revolution at lists.runrev.com>
Sent: Tuesday, January 09, 2007 7:48 AM
Subject: Re: Replace Text in Lines


> Hi Michael,
>
>> Hi  all
>> I have a numbered text file with 1 to 800 lines, I need to replace  text 
>> in specific lines with text from a field. I can replace by  individual 
>> lines with the replace into a single line number, but  how is this done 
>> with mutliple odd lines ?
>>
>> replace 12345 with 67890 in the text file in all the listed odd 
>> individual line numbers.
>>
>> example
>> 67890-Dataname  < field "replace" contents
>>
>> set the itemdelimiter to "-"
>> put item 1 of fld replace into lines 
>> 299,322,345,368,391,414,437,460,483,506 of field "textfile"
>
> Looks like you need a nice repeat loop :-)
>
> ...
> set the itemdelimiter to "-"
> put item 1 of fld replace into text2replace
> put fld "textfile" into tTextfile
> ## Doing everything in memory instead of manipulating the field  directly 
> will speed up things a LOT!
> set itemdel to ","
> repeat for each item i in "299,322,345,368,391,414,437,460,483,506"
>    put text2replace into line i of tTextfile
> end repeat
> put tTextfile into fld "textfile"
> ...
>
> Et voila!
>
> Hope that helps.
>
>> Michael
>
> Regards from germany
>
> Klaus Major
> klaus at major-k.de
> http://www.major-k.de
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution 




More information about the use-livecode mailing list