1.

Solve : Convert UNIX file format to DOS file format?

Answer»

Need help to convert the file format from UNIX to DOS format. UNDERSTAND that most people will convert in UNIX server to DOS format. However, due to resource constraingt, we are unable to do so.

Is there any available DOS commands to achieve this? Thanks.for a unix TEXT file to DOS, its a replacement of the "\n" to "\r\n"
Here's a Python script to do that:
Code: [SELECT]output = open("converted_file.txt","a")
for lines in open("file_to_convert.txt"):
lines = lines.replace('\n', '\r\n')
output.write(lines)
output.close()

Another way is to convert in Unix first, using the command unix2dos.
You can also use sed/awk on windows to do the conversion.

Similarly, in vbscript,there's a Replace function to do that.No need to re-invent the wheel. >Here's< a command line tool suitable for Win95 onwards.Thanks to everyone who have posted to my query. However, my problem still exists.

Maybe I should give the business background.. I have a CUSTOMER running PeopleSoft HRMS v8.9. They have this third party called file sender and receiver adapter. What it does is to push files to a wintel server using F-Secure SCP2 commands and return the notification message in the form of XML format. The notification message gets transferred to the customer's wintel server but is in UNIX format. We are unable to open it in DOS MODE using SQR program via PeopleSoft application.

We are trying to find any existing DOS commands and freeware to convert the XML file (UNIX format) to DOS format.


firstly, what have you tried ? did you use the unix2dos freeware that rob posted? How did you use it ?
that freeware is an exe file. so just open up a command prompt in windows , execute it against your XML file will do.
i do not know this will work since you are not the customer , but another alternative is to request your customer to convert it first in their unix box before pushing to you. (...)
Yes I did. But we need something that can be executed from the DOS command prompt in the following format :

%1 %2 where %1 is the file with UNIX format and %2 is the file with DOS format after conversion using .

Thanks.I found this http://www.bastet.com/uddu.zip.
you can give it a shot.
Else, you could do your own scripting
Logic:
read in the file line by line
replace the last character of the line to "\r\n"
write the line to output file




My apologies; I mis-read the info for that program I provided the link to. I hadn't realised it was GUI-only. Ghostdog's link to uddu is better and will do the trick. Sorry for the wild goose chase.



Discussion

No Comment Found