LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-04-2009, 08:42 AM   #1
kdblearn
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Rep: Reputation: 0
dos2unix


I am using Ubuntu with kernel 2.6.31.1. I am not finding dos2unix.
Can you please help me about how I can install this from any source or any equivalent one for dos2unix. Or any solution to remove "^M" character in the source files that I want to compile now.
Thanks,
-KDB Learner
 
Old 10-04-2009, 10:10 AM   #2
ajlewis2
Member
 
Registered: Nov 2003
Distribution: Ubuntu
Posts: 218

Rep: Reputation: 46
Code:
sudo apt-get install tofrodos
check man tofrodos for how to use it. It looks about the same as dos2unix which I did not find in the repository.
 
Old 10-04-2009, 10:11 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
There's a tool similar to it called flip available in the debian repositories, so it's probably also in *buntu.

You can also simply use sed to convert the line endings. This page includes the proper code (about one page down), along with many other useful one-liners.
 
Old 10-04-2009, 11:03 AM   #4
kdblearn
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Original Poster
Rep: Reputation: 0
SOLVED
Thanks to ajlewis2 and David the H.
I got the solution now. I installed sudo apt-get install tofrodos. Also doing the "man tofrodos" gave me the two commands "fromdos" and "todos". Using "todos -f * *", I was able fix the "^M" issue in all the files in a directory.
-KDBlearn
 
Old 10-04-2009, 11:08 AM   #5
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
It looks like it's in package tofrodos in debian.

# apt-get install tofrodos

$ apt-file find dos2unix

Assuming that apt-file is installed and updated.

# apt-get install apt-file
# apt-file update

dos2unix and unix2dos just change the 0x0D0A to 0x0A and similar. Because the OS's differ in how text files end their lines. 0x0D is carraige return. And 0x0A is linefeed. \r\n for echo commands and the likes. I don't quite recall which is which by a quick echo to a file and hexedit / hexdump should show that detail. It's a printer thing. Back when you typed things on mechanical devices. There was one way to bring the roll back to the start of the line, and nother to feed the paper up a line. Carraige return and line feed. Dos/windows does 0x0D0A, *nix does 0x0A, and Mac does 0x0D or something like that. I probably got something changed around in there somewhere. And it's part of the reason that you have to tell ftp clients which transfer mode (binary/ascii) when getting data from that method. So that the ftp client can do the dos2unix / unix2dos conversion for you on text files. Based on what it thinks your client / platform is.
 
  


Reply



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 dos2unix /opt/SV DC/*.* using system command.Here path is having space. nagendrar Linux - Newbie 1 08-06-2009 05:27 AM
dos2unix - problems renaming tmpfile to outfile jaewoong.kim Linux - General 5 12-31-2008 05:25 AM
Use of dos2unix command Karthikeyan Gurusamy Linux - Newbie 3 02-02-2006 06:32 AM
dos2unix command on a folder raghunandan Linux - Software 1 12-12-2005 07:50 AM
dos2unix package alaios Debian 1 01-16-2005 06:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:33 AM.

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
Open Source Consulting | Domain Registration