LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 04-13-2008, 10:45 PM   #1
visitnag
Member
 
Registered: Mar 2008
Posts: 147

Rep: Reputation: 15
Replace Ctrl-M (^M) characters with spaces....


I have a print file which is having so many ^M (Ctrl-M) characters. How can I replace or delete these using vi editor? or any other solution (sed?)
 
Old 04-13-2008, 10:59 PM   #2
tiocsti
LQ Newbie
 
Registered: Apr 2008
Location: Atlanta, GA
Distribution: [linux] Ubuntu, [bsd] FreeBSD, NetBSD
Posts: 21

Rep: Reputation: 15
Quote:
Originally Posted by visitnag View Post
I have a print file which is having so many ^M (Ctrl-M) characters. How can I replace or delete these using vi editor? or any other solution (sed?)
:%s/ctrl-vctrl-m//g

where you see ctrl-v i mean press ctrl-v, and where you see ctrl-m, i mean press ctrl-m.
 
Old 04-14-2008, 12:19 AM   #3
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
There are commands fromdos and dos2unix to premanently change the file.
Else sed would be the tool to use

See also http://www.linuxquestions.org/questi...hlight=fromdos

vi is not really the right tool to use for this purpose.
 
Old 04-16-2008, 09:05 AM   #4
visitnag
Member
 
Registered: Mar 2008
Posts: 147

Original Poster
Rep: Reputation: 15
When i press Ctrl-M the cursor is going to somewhere else. But strangely i can replace Tabs with anything
 
  


Reply

Tags
vi


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
script to replace spaces with - lleb Linux - Newbie 16 01-04-2008 04:15 PM
Cannot replace spaces w/ underscores clem_c_rock Linux - Newbie 7 09-27-2007 01:17 PM
How to modify the names of files and replace characters with other characters or symb peter88 Linux - General 2 12-10-2006 03:05 AM
How to replace spaces in filenames with underscores rosslaird Linux - Software 4 02-22-2005 01:08 AM
Help! Null Characters to spaces FoxyNewbie Programming 7 05-27-2004 12:10 PM


All times are GMT -5. The time now is 01:22 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration