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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-24-2010, 07:21 PM
|
#1
|
LQ Newbie
Registered: Jan 2010
Posts: 4
Rep:
|
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.
|
|
|
01-24-2010, 07:24 PM
|
#2
|
Member
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 703
Rep:
|
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.
|
01-25-2010, 12:26 AM
|
#3
|
LQ Newbie
Registered: Apr 2009
Location: india
Distribution: ubuntu 9.10
Posts: 11
Rep:
|
you can also use abiword or openoffice as they support large number of extensions...
|
|
|
01-25-2010, 01:03 AM
|
#4
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,797
|
In Ubuntu, they are called todos and fromdos if I'm not mistaken.
|
|
|
01-25-2010, 02:03 AM
|
#5
|
Member
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724
Rep: 
|
Quote:
Originally Posted by Wim Sturkenboom
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.
|
|
|
01-25-2010, 02:14 AM
|
#6
|
Senior Member
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897
Rep:
|
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.
|
01-25-2010, 03:20 AM
|
#7
|
Member
Registered: Oct 2008
Location: Pakistan, Islamabad
Distribution: CentOS, Fedora, Solaris
Posts: 154
Rep:
|
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.
|
|
|
01-26-2010, 12:29 AM
|
#9
|
LQ Newbie
Registered: Jan 2010
Posts: 4
Original Poster
Rep:
|
Quote:
Originally Posted by Wim Sturkenboom
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.
|
|
|
01-27-2010, 05:26 AM
|
#10
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,797
|
Quote:
Originally Posted by gagraf
I found dos2unix and unix2dos in Ubuntu package sysutils. Thanks for your reply.
|
My mistake. todos and fromdos apply to slackware.
|
|
|
All times are GMT -5. The time now is 03:50 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|