#DEFINE _CR_ CHR(13) #DEFINE _LF_ CHR(10) #DEFINE _NL_ _CR_+_LF_ SELECT eit SCAN cBuf = CHRTRAN(ALLTRIM(narry),_LF_,_CR_) DO WHILE _CR_+_CR_ $ m.cBuf narry = STRTRAN(m.cBuf,_CR_+_CR_,_CR_) ENDDO cBuf = STRTRAN(m.cBuf_CR_,_NL_) = strtofile(cBuf, 'c:\colineit.txt', 1) = strtofile( _NL_+REPLICATE('-',20)+_NL_,'c:\colineit.txt',1) ENDSCANto get rid of the extraneous lines with dashes, we could modify thusly:
#DEFINE _CR_ CHR(13) #DEFINE _LF_ CHR(10) #DEFINE _NL_ _CR_+_LF_ SELECT eit SCAN cBuf = CHRTRAN(ALLTRIM(narry),_LF_,_CR_) DO WHILE _CR_+_CR_ $ m.cBuf narry = STRTRAN(m.cBuf,_CR_+_CR_,_CR_) ENDDO cBuf = RTRIM(m.cBuf,_CR_," ") cBuf = STRTRAN(m.cBuf_CR_,_NL_) = strtofile(cBuf+_NL_, 'c:\colineit.txt', 1) ENDSCANThe effect of all those CHRTRAN() and STRTRAN() calls is to basically translate the instances of carriage return and linefeed and turning them into newline sequences of carriage return followed by newline. I'm also reducing repeated newlines into single ones (basically removing "blank" lines). Also at the end when appending string to file, I'm making sure that there is a newline at the end.