how to move a line of a variable to previous line
Posted: Sun Jan 19, 2014 12:45 am
I have a very large text file that I need to modify daily to make it an importable data base file. I am trying to automate this process. The file consists of several data base fields and is given to me by another department. The data gets slightly rearranged in the process so that 1 line of data may get moved to several lines in the text file. What I have to do is look at each line, and if it is not the beginning of the line of data, hit backspace and space to add it to the previous line. The first field of each line of data is a PO number and is always written as one letter and six number in quotations E.G. "A111111". It is my thought to use this criteria to determine if that line should be left alone or moved to the end of the previous line. My problem (so far) is that I am not sure how to tell the program to move a line to the end of the previous line and put a space between them.
Code: Select all
open file "Import/import.TXT" for read
read from file "Import/import.TXT" until EOF
put it into field fText
close file "Import/import.TXT"
repeat with i = the number of lines in field fText down to 1
if the first character of line i of field fText is quote and the ninth character of line i of field fText is quote
then beep
else
--I need this part to move line i to the end of line (i-1) separated by a space
end if
end repeat