LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-25-2005, 07:16 PM   #1
King4lex
Member
 
Registered: Aug 2004
Distribution: Fedora Core 4
Posts: 90

Rep: Reputation: 15
Very annoying: ^M


Hi,

I have some files on my Windows box that I zipped and transfered to my FreeBSD box where I unzipped them and plan to work on them. However (using vi as my editor) at the end of each line there is this: ^M. It's very annoying and distracting. Is there any way for me to remove this from my files? Example from one of the files so you can see what I mean:

Code:
<?include('prefix.php');?>^M
<?^M
$userLevel=0;^M
$printit=1;^M
$em="Your e-mail";^M
^M
if (isset($HTTP_COOKIE_VARS["username"]) && isset($HTTP_COOKIE_VARS["userpass"])) {^M
  $name=safevar($HTTP_COOKIE_VARS["username"]);^M
  $pass=safevar($HTTP_COOKIE_VARS["userpass"]);^M
} else {^M
  $name=null;^M
  $pass=null;^M

--king4lex
 
Old 08-25-2005, 07:21 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Open up vi in command mode and do the following in CMD mode (ESC):

:1,$ s/^M//g

To get the ^M do a ctrl-v then ctrl-m

Press enter and whala.. all gone. :wq! to quit and save and or Shift+ZZ will save and quit.
 
Old 08-25-2005, 07:23 PM   #3
King4lex
Member
 
Registered: Aug 2004
Distribution: Fedora Core 4
Posts: 90

Original Poster
Rep: Reputation: 15
Thanks! I just didnt know how to get the ^M.
 
Old 08-25-2005, 08:03 PM   #4
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
There's also a program called dos2unix that's included (or at least packaged) with most distros.
 
Old 08-25-2005, 08:39 PM   #5
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by tkedwards
There's also a program called dos2unix that's included (or at least packaged) with most distros.
Yup but I never bother when I do most of my editing myself in vi. At times, I don't always trust the automated programs, probably why I do more administering in the CLI than a GUI..
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how annoying php Linux - Distributions 9 01-05-2007 09:42 PM
fortunes getting annoying nny0000 Slackware 4 02-25-2004 01:55 PM
very annoying/browser wr3ck3d Linux - Software 7 04-16-2003 05:57 PM
This is so annoying please help... Z28kid Linux - Newbie 8 03-10-2003 03:54 PM
Really annoying Bigun Linux - General 6 09-15-2002 05:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:47 PM.

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