LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 07-02-2005, 09:54 AM   #1
fisayo
Member
 
Registered: Apr 2005
Distribution: Suse 9.3 | Mandrake 10.0 - 10.1
Posts: 39

Rep: Reputation: 15
Migrate text files to windows


Hi! I'm writing a backup script that creates an index (in a text file) of all the files that have been backed up. The problem I have is that when this file is opened on Windows with notepad (or other wordprocessors), it combines different lines together and uses some strange characters to replace newline. I would appreciate if I can get any useful links or some help on how to retain the structure of the file i.e. it should show the same way it would on my Linux.

SAMPLE:
On my linux machine
$ cat index_file.txt
/home/ayo/mp3/david_lanz/classical_jazz/01_track_01.mp3
/home/ayo/mp3/david_lanz/classical_jazz/04_track_04.mp3
/home/ayo/mp3/david_lanz/classical_jazz/05_track_05.mp3
/home/ayo/mp3/david_lanz/classical_jazz/02_track_02.mp3
/home/ayo/mp3/david_lanz/classical_jazz/03_track_03.mp3
/home/ayo/mp3/david_lanz/classical_jazz/09_track_09.mp3
/home/ayo/mp3/david_lanz/classical_jazz/10_track_10.mp3
/home/ayo/mp3/david_lanz/classical_jazz/06_track_06.mp3
/home/ayo/mp3/david_lanz/classical_jazz/07_track_07.mp3
/home/ayo/mp3/david_lanz/classical_jazz/08_track_08.mp3
/home/ayo/mp3/david_lanz/classical_jazz/11_track_11.mp3

On windows, it joins most of the lines together and replaces the newline with funny boxes.
 
Old 07-02-2005, 10:21 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,157

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Windows uses different end of line characters for text files. Linux 0x0a and windows a 0xa,0x0d. Without the 0x0d the text appears to be all on one line. Wordpad will display a linux text file correctly. unix2dos and dos2unix are linux utilities to convert between the two formats. The windows shareware textpad application is an excellent ASCII text editor that can open and save files in both formats.
 
Old 07-02-2005, 10:48 AM   #3
thrombomodulin
LQ Newbie
 
Registered: Dec 2003
Location: MI, USA
Distribution: FC 2
Posts: 14

Rep: Reputation: 0
windows ascii/binary format

I transfer files to windows frequently using the program 'zip' which does assignment of ascii file types.

For example:

find somefiles_that_are_ascii | zip transferme.zip -l -@
find somefiles_that_are_binary | zip transferme.zip -@

This gives a zip file that will decompress on windows correctly. (-l option means to extract asciii format).

Regards,
T
 
Old 07-03-2005, 05:01 PM   #4
fisayo
Member
 
Registered: Apr 2005
Distribution: Suse 9.3 | Mandrake 10.0 - 10.1
Posts: 39

Original Poster
Rep: Reputation: 15
Thanks for your help. Unix2dos works perfectly with what I want. I really appreciate your help. Thanks once again
 
Old 07-04-2005, 11:24 AM   #5
Boow
Member
 
Registered: Feb 2004
Distribution: Slackware 10.2
Posts: 669

Rep: Reputation: 32
todos fromdos works also if you distro has those cmds.
 
  


Reply


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert DOS text files to UNIX text files ta0kira Linux - Software 7 03-15-2011 12:42 PM
how to convert windows formatted text files to *nix formatting? zero79 Linux - General 8 06-11-2004 04:00 AM
windows user wanting to migrate to linux enhancedcrash Linux - Newbie 8 10-19-2003 04:37 PM
How difficult is it to migrate from linux to windows what are the issues involved Paula01 Linux - General 2 03-12-2002 06:30 AM
How difficult is it to migrate from linux to windows what are the issues involved Paula01 Linux - General 0 03-12-2002 05:21 AM


All times are GMT -5. The time now is 01:51 PM.

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