Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-16-2009, 03:06 AM   #1
Registered: Dec 2004
Posts: 81

Rep: Reputation: 15
Linux Text File convert to Windows/Notepad Text File = Wrapped?

Hi forum!!!

I need help in converting Linux Text File to Windows/Notepad Text File.

Before I transfer the file, I vi the file and the format is OK then I transfer via FTP. When I transfer a text files in Linux, I use ASCII not Binary.

Now, the file is now in windows (without an extension of course). I able to view the file in dos by doing "c:\edit file2008" and the dos editor normally display it correctly like in vi but when I view it in Notepad, it got wrapped.

I tried doing....unix2dos but I got some error.

[younguns@younguns Ledgers]$ unix2dos file2008 -c ASCII newfile2008
unix2dos: converting file file2008 to DOS format ...
unix2dos: converting file newfile2008 to DOS format ...
unix2dos: problems converting file newfile2008
[younguns@younguns Ledgers]$

Any help about doing this is much appreciated.

Thank you in advance.
Old 01-16-2009, 11:17 AM   #2
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
What does it look like in wordpad rather than notepad?
Old 01-16-2009, 11:18 AM   #3
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
You should try:

  unix2dos -n -c ASCII file2008 newfile2008
Without -n unix2dos will assume all files have to be converted. With -n will assume the first file is the input and the second file is the output.
Old 01-18-2009, 02:22 AM   #4
Registered: Dec 2004
Posts: 81

Original Poster
Rep: Reputation: 15
Originally Posted by Tinkster View Post
What does it look like in wordpad rather than notepad?

Well..when I open it in wordpad its not wrapped it has spaces in between e.g. same with edit (dos) & vi. But in notepad it got wrapped.

I use notepad to test whether it will be correctly displayed. If this is correctly displayed in notepad, the file then can now be uploaded with a gov't agency use of their database record (probably they use VB...don't know).

The only work around I know, other than the other guys suggested about unix2dos is use "edit" to open in dos then save it then when I open this in notepad it is not wrapped anymore.

What I wonder about is that 2 months ago before we migrated from SCO to RHEL is that the SCO txt files are OK meaning when I transferred it to Windows & open it notepad, its not wrapped or it displayed as it should.


Last edited by backroger; 01-18-2009 at 02:25 AM.
Old 01-18-2009, 05:54 AM   #5
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
I do not get what you ask exactly, but I can try to explain what happens.

The problem is the convention used to identify a newline in a text file. Usually UNIX/Linux has a different 'convention' from Windows (no idea about what SCO uses).

Now, you usually use text editors to work with these files. Some know about both 'conventions' (like wordpad) and display the text properly, some know just their 'convention' (like notepad) and you need to take care of the transformation yourself (dos2unix/unix2dos).


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to parse text file to a set text column width and output to new text file? jsstevenson Programming 12 04-23-2008 02:36 PM
Steps needed to convert multiple text files into one master text file jamtech Programming 5 10-07-2007 11:24 PM
how to convert wordpad(rtf) doc to linux text file? kpachopoulos Linux - General 2 10-28-2005 10:53 AM
How to convert binary text file from Windows marie@dk Linux - Software 2 10-12-2005 03:17 AM
convert text file to binary excel file ust Linux - General 2 11-23-2004 02:33 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration