Solved

Using sed to remove control-M from a series of files

Posted on 1997-11-12
5
1,458 Views
Last Modified: 2013-12-26
I program in DOS and LINUX and often transfer files back and forth.  When I take a file from DOS to LINUX, control-M characters are added at the end of each line.  While these can be removed in textedit one by one, I have a number of files and want to automate it.  I would guess that sed could remove the character from a group of files, but I have no idea how to do it.
0
Comment
Question by:wiggin
5 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1295597
tr -d '\015'
0
 
LVL 4

Accepted Solution

by:
feenix earned 50 total points
ID: 1295598
You can use this in a script:

sed s/^V^M// < file.dos > file.unix

0
 
LVL 84

Expert Comment

by:ozo
ID: 1295599
assuming
stty lnext ^V
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1295600
Linux has: duconv      :-))
You also may use: mcopy -t
0
 

Expert Comment

by:jrg
ID: 1295601
There is a utility on SunOS machines named "dos2unix"
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now