Converting Unix text to windows


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Converting Unix text to windows
# 1  
Old 06-13-2005
Power Converting Unix text to windows

I am trying to FTP a text file from a machine running LynxOS and I am having problems with the way windows "sees" the characters. For example this is how windows presents the text:

    DevProcRcpClass

The boxes are what I am having problems with. When viewing the same file on a Sun workstation the boxes show up as alphabetical charaters
and the spaces show up with @ symbols.

I set the transfer mode to ascii in a couple of different ftp programs and see the
same both ways. I really know nothing about unix and any help would be greatly appreciated. Thanks for your time.
# 2  
Old 06-13-2005
Well the boxes did not show up in front of the text "DevProcRcpClass". The forums dont like it either. Anyway, windows is interpreting the characters as boxes when they really should be letters. Thanks.
# 3  
Old 06-13-2005
Either you're tranferring the file in binary mode rather than ascii mode or you can try using this to fix your problem (sorry I'm a PHP man and don't know a better way off-hand).

Save the following as "unix2dos" filename
------------------------------------
PHP Code:
#!/usr/bin/php
<?php

$in 
$argv[1];
$out $argv[2];

$unix_data file_get_contents($in); //Read the file

$win32_data preg_replace("#\n#""\r\n"$unix_data); //Turn linebreaks into carriage returns

$handle fopen($out'w'); //Create new file for writing
if (fwrite($handle$win32_data)) { //Write the data to the new file
    
echo "\n$out created as Win32 compatible file successfully!\n";
} else {
   echo 
"\nThere has been a problem writing data to $out...\n";
}
fclose($handle); //Close the file

?>
Then simply run:

chmod +x unix2dos
./unix2dos oldfilename.txt newfilename.txt

and voila! A dos compatible file Smilie

*d11wtq moderates devnetwork php forums btw Smilie
# 4  
Old 06-13-2005
Unix has utilities called ux2dos (or unix2dos) and dos2ux (or dos2unix) - FWIW.

try man ux2dos
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. What is on Your Mind?

Converting an old windows vista system to Unix

I have an old Dell system that I would like to convert over to a Unix system and I have no idea how to do this. Where can I go to get the information to do this. This will be a secondary computer that I will learn and "play" with. I have heard that it is fairly easy to do and that once I get used... (0 Replies)
Discussion started by: Richard.Borden2
0 Replies

2. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

3. UNIX for Dummies Questions & Answers

Send Text message from unix to windows

Hi Buddies, I have a unix client and want to send a message (containg some data) to a windows Database server to query from it and return the result. I shall be so thankfull if you help me out.:b::) Warm Regards, Jessi (1 Reply)
Discussion started by: jessica-adams
1 Replies

4. UNIX for Dummies Questions & Answers

Converting a Windows system to a UNIX system

Hello I am looking for advise on how to convert a windows based computer system into a UNIX based operating system.. I would like to be able to learn UNIX better than I know it and work didn't allow me to work with UNIX much. Is there a book where I could learn how to accomplish that... (6 Replies)
Discussion started by: baksg1995
6 Replies

5. Shell Programming and Scripting

FTP some text files from Windows box to unix

hi all, can anybody help me with script or command to ftp some text file from windows machine to AIX machine. this is shud be done by executing a shell script. (1 Reply)
Discussion started by: suprithhr
1 Replies

6. Windows & DOS: Issues & Discussions

DOS/Windows CR to a UNIX LF 17 MB text file

Hello, I am on a WinXP home machine with a 17 MB text file and I need to change the DOS/Windows CR to a UNIX LF. Does anyone know how I can do this or even better a WinXP program that can do this for me ? My hobby is my Family History. I know very little about all this type stuff and I... (9 Replies)
Discussion started by: tex
9 Replies

7. Shell Programming and Scripting

how to remove ^M from windows text file in unix

Hi, Need help on windows text file that i get in unix server and need to change and resend for process. Now there is a ^M will be placed for each line of that file i need that to be removed . Someone please help me. Thanks in advance for all help. (1 Reply)
Discussion started by: pragy1999
1 Replies

8. Shell Programming and Scripting

Converting Text File into XML using Unix Shell Scripts

Hi everyone, If someone out there could help me out with this problem. I would really appreciate it. I am trying to convert a file into xml format using Unix shell scripts. The file has fields with each field having a certain number of bytes, but the fields are not delimited by anything... (10 Replies)
Discussion started by: Laud12345
10 Replies

9. Shell Programming and Scripting

windows to unix text in subdirectories

Hey, I'm trying to install a java web archive on unix but all the jsp's are in windows text format. I need to convert them all to unix text at once but I really don't want to do that on a file per file basis so I need to loop over all text files in all subdirectories and change the ^M. Does... (4 Replies)
Discussion started by: rein
4 Replies

10. UNIX for Dummies Questions & Answers

converting files from unix to windows

Need Help?? We receive Files From GM Motors and they written on a Sun Workstation using the Tar Command on a 4mm Dat Tape. We have an HP sure Store 24 Tape drive that will Execpt but when i do that it says that the media is bad. was wondering if there was any software that would read it in its... (2 Replies)
Discussion started by: jefft1976
2 Replies
Login or Register to Ask a Question