Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 1997-11-12
5
Medium Priority
?
1,525 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 84

Expert Comment

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

Accepted Solution

by:
feenix earned 100 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

618 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