;; I am attempting replace text in a file between
;; two delimiters.
;; The first step is to remove original text:
;; code as follows (the line with code
remove first fp
;; doesn't do what I would expect it to
;; code follows, after that is text file
fp: open/lines/mode %test.txt [read write lines]
remove_flag: 0
lines_done: 0
forall fp
[
if(find first fp "begin insert here")
[
print "found"
remove_flag: 1
;insert next fp insert_txt
]
if(find first fp "end insert here")
[
remove_flag: 0
print "done"
]
if(remove_flag > 0)
[
either lines_done > 0
[
print["Removing " first fp]
remove first fp ;; I want this line removed
]
[
print "setting lines_done"
lines_done: 1
]
]
]
update fp
close fp
;; text file text as follows:
file begins
<!--begin insert here-->
original line one
original line two
original line three
<!--end insert here-->
file ends