Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing break lines from a .txt file
Message
From
21/02/2007 17:33:43
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
21/02/2007 17:19:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01197525
Message ID:
01197808
Views:
16
>Actually, when I lookd at the file with a Hex editor, every line was terminated with 0D0A. I did not see an embedded 0A.

That's strange. Did you download it or open it from the link and then save it? The embedded OA was in the last line after the word Deliver.

>
>You do raise a valid point. Many developers do not know that Unix/Linux 'lines' are terminated with LF only and Mac lines used to be terminated with 'CR' only. Not sure if it is still the case with Mac since the move to OSx.
>
>>>>>
>>>>>Moises
>>>
>>>Mike,
>>>You got me. Now I am very curious. Check Message #1197540. There Moises post a link to the file, but that file contains no header row. But you always could add one :-)
>>
>>Specifications are really a good thing. A sample of the file and a sample of the result is important. I examined the file with hex editor. Every line is terminated with ",LF". There is one row with an extra LF.
>>
>>What should happen to the row with the embedded LF?
>>
>>How is it that code like strtran(lcFileStr,chr(10)+chr(13),"|") is working at all?
>>
>>Anyways, here's my contribution. This will read in the file, terminating at the LFs and dropping them too. Then it will output the file with chr(10)+chr(13). It's not as fast on such a small sample, but it's really simple.
>>
>>
CREATE CURSOR temp (cline c(100))
>>APPEND FROM source.txt TYPE SDF
>>COPY fields cline TO target.txt DELIMITED WITH ""
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform