Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Conversion: UNIX.txt to DOS.txt and trim trailing blanks

Status
Not open for further replies.

karlomutschler

Programmer
Jun 5, 2001
75
DE
On a weekly basis we report that is created in an UNIX.txt format.
This file needs to be converted as follows:
1. from UNIX.txt to DOS.txt
2. trailing blank spaces removed.

How could this file be converted (using Clarion code) into a DOS.txt format and the blank spaces removed.
Info:
The difference between the 2 types of txt.formats is: in the DOS.txt format the rows of data are ended by a CR/LF.

For the conversion from UNIX.txt to DOS.txt 3 scenarios need
to be addressed:
1. IF a CR is found without a LF, a LineFeed is added
2. IF a LF is found without a CR, a CarriageReturn is inserted before it
3. IF the signs are switched around (LF/CR), the signs are ordered correctly as CR/LF.

Then the trailing blank spaces from the specified value needs to be removed:
For example "some text  " ==>> "some text".

Once this is done, the data is correctly formated and can be used.

Would you be able to help me in this matter ?
TIA and kind regards
Karlo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top