Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jan 1999 07:05:30 -0500
From:      "Jeff Ehrenkrantz" <admin@gccomm.net>
To:        <questions@FreeBSD.ORG>
Subject:   After the fact replacing ^M
Message-ID:  <003e01be3d5a$c2034de0$3142f5cf@whyy.org>

next in thread | raw e-mail | index | archive | help
here is an "after the fact" perl script that will strip the code from a text
file and copy the original to *.prevyou will have to use it on itself if you
use msdos to transfer the file.


#!/usr/bin/perl -pi.prev
s/\015/\n/g ;

----- Original Message -----
From: <charon@freethought.org>
To: <questions@FreeBSD.ORG>
Sent: Monday, January 11, 1999 1:59 AM
Subject: replacing ^M in vi


Whenever I save a plain text file in WinNT and open it in FreeBSD, at the
end of every line is a "^M".  How do I get rid of these?  I tried writing a
little C++ program to copy all text except "^M" to another file, but it
doesn't work because C++ treats the ^ and the M as different characters,
whereas vi treats them as _one_ character.  After searching the mailing
list archives, I came up with the syntax ":%s/stuff/other stuff/g" as the
oh-so-intuitive replace command in vi, and I tried it, but to no avail (it
says "no match found").  Any suggestions?  Thanks,



        Charon@freethought.org
 http://members.home.net/tuathadedanann/

   alt.sex.fetish.hamster.duct-tape

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?003e01be3d5a$c2034de0$3142f5cf>