home *** CD-ROM | disk | FTP | other *** search
- set infile to (choose file with prompt "Input file?" of type "TEXT")
- set infileref to (open for access file "Macintosh HD:Desktop Folder:infile")
- set outfile to (new file with prompt "Output file?" default name "outfile")
- set outfileref to (open for access outfile with write permission)
- set starttime to current date
- copy (read infileref as list using delimiter return) to fileText
- close access infileref
- repeat with i from 1 to the number of items in fileText
- repeat until not (item i of fileText contains "╤")
- set foundOffset to offset of "╤" in (item i of fileText)
- if foundOffset = 1 then
- set stringStart to ""
- else
- set stringStart to text 1 thru (foundOffset - 1) of item i of fileText
- end if
- if foundOffset = the number of characters in (item i of fileText) then
- set stringEnd to ""
- else
- set stringEnd to text (foundOffset + 1) thru (the number of characters in (item i of fileText)) of item i of fileText
- end if
- set item i of fileText to stringStart & "--" & stringEnd
- end repeat
- write (item i of fileText) & return to outfileref
- end repeat
- close access outfileref
- set endtime to current date
- display dialog (((the number of items in fileText) as string) & " lines processed in " & (endtime - starttime) as string) & " sec"
-