LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-24-2010, 07:21 PM   #1
gagraf
LQ Newbie
 
Registered: Jan 2010
Posts: 4

Rep: Reputation: 0
Question How do I convert text files between Windows(Dos) and Linux?


What is a good way to do it? I have been trying to do it using sed.
 
Old 01-24-2010, 07:24 PM   #2
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703

Rep: Reputation: 97
There are two neat little programs, unix2dos and dos2unix.

If you run Red Hat, CentOS or Fedora, run "yum install unix2dos dos2unix".
 
1 members found this post helpful.
Old 01-25-2010, 12:26 AM   #3
rathin2j
LQ Newbie
 
Registered: Apr 2009
Location: india
Distribution: ubuntu 9.10
Posts: 11

Rep: Reputation: 1
you can also use abiword or openoffice as they support large number of extensions...
 
Old 01-25-2010, 01:03 AM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
In Ubuntu, they are called todos and fromdos if I'm not mistaken.
 
Old 01-25-2010, 02:03 AM   #5
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
Quote:
Originally Posted by Wim Sturkenboom View Post
In Ubuntu, they are called todos and fromdos if I'm not mistaken.
... and combine is tofrodos.

Today, I got some shell scripts are written on Windows, and I need to use this utility to covert the end-of-line character to UNIX format. If not, I will got the "syntax error near unexpected token `do" error when execute it.
 
Old 01-25-2010, 02:14 AM   #6
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 63
It often happens that you don't have unix2dos programs installed. At one time, converting files implied converting between charsets (that was DOS). Nowadays (Windows), it's just a matter of line endings. So converting is as easy as using this always available command:
Code:
tr -d '\r' <dos_file_to_be_converted >converted_result
Yves.
 
1 members found this post helpful.
Old 01-25-2010, 03:20 AM   #7
sohail0399
Member
 
Registered: Oct 2008
Location: Pakistan, Islamabad
Distribution: CentOS, Fedora, Solaris
Posts: 154

Rep: Reputation: 23
unix2dos and dos2unix is present in most of the linux flavors.

in solaris it is also present but syntax is somewhat different:

unix2dos -n unix-file new-dos-file

It is also good to find out the other ways and solution.
 
Old 01-25-2010, 09:36 AM   #8
sumeet inani
Member
 
Registered: Oct 2008
Posts: 902
Blog Entries: 26

Rep: Reputation: 49
You already have lot of options.
here is another
http://www.cyberciti.biz/faq/howto-u...x-text-format/

If this helps you then thank me by pressing thumbs up button.
Thank You.
 
Old 01-26-2010, 12:29 AM   #9
gagraf
LQ Newbie
 
Registered: Jan 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally Posted by Wim Sturkenboom View Post
In Ubuntu, they are called todos and fromdos if I'm not mistaken.
I found dos2unix and unix2dos in Ubuntu package sysutils. Thanks for your reply.
 
Old 01-27-2010, 05:26 AM   #10
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by gagraf View Post
I found dos2unix and unix2dos in Ubuntu package sysutils. Thanks for your reply.
My mistake. todos and fromdos apply to slackware.
 
  


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 Off
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 11:42 AM
LXer: Flip - Convert text file line endings between Unix and DOS formats LXer Syndicated Linux News 1 03-03-2009 01:38 PM
Linux Text File convert to Windows/Notepad Text File = Wrapped? backroger Linux - Software 4 01-18-2009 05:54 AM
Steps needed to convert multiple text files into one master text file jamtech Programming 5 10-07-2007 11:24 PM
how to convert windows formatted text files to *nix formatting? zero79 Linux - General 8 06-11-2004 03:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:36 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration