From owner-freebsd-questions@FreeBSD.ORG Sat Oct 28 01:20:49 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 935E716A40F for ; Sat, 28 Oct 2006 01:20:49 +0000 (UTC) (envelope-from ltsampros@upnet.gr) Received: from mx.vivodinet.gr (mx1.vivodinet.gr [83.171.203.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id D002D43D45 for ; Sat, 28 Oct 2006 01:20:47 +0000 (GMT) (envelope-from ltsampros@upnet.gr) Received: from localhost (localhost.localdomain [127.0.0.1]) by mx.vivodinet.gr (Postfix) with ESMTP id 6F4E5368184; Sat, 28 Oct 2006 04:20:44 +0300 (EEST) X-Virus-Scanned: amavisd-new at vivodinet.gr Received: from mx.vivodinet.gr ([127.0.0.1]) by localhost (mx1.vivodinet.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qhUDQ8ynY91v; Sat, 28 Oct 2006 04:20:40 +0300 (EEST) Received: from biftekaki.lan (dsl-88-218-3-32.customers.vivodi.gr [88.218.3.32]) by mx.vivodinet.gr (Postfix) with ESMTP; Sat, 28 Oct 2006 04:20:40 +0300 (EEST) Received: from biftekaki.lan (localhost [127.0.0.1]) by biftekaki.lan (8.13.6/8.13.6) with ESMTP id k9S1IxrX031891; Sat, 28 Oct 2006 04:19:00 +0300 (EEST) (envelope-from ltsampros@biftekaki.lan) Received: (from ltsampros@localhost) by biftekaki.lan (8.13.6/8.13.6/Submit) id k9S1IwXq031890; Sat, 28 Oct 2006 04:18:58 +0300 (EEST) (envelope-from ltsampros) Date: Sat, 28 Oct 2006 04:18:57 +0300 From: Tsampros Leonidas To: Jerry McAllister Message-ID: <20061028011857.GA31746@biftekaki.lan> References: <45425D61.6030209@enabled.com> <20061027213034.GD98266@gizmo.acns.msu.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-7 Content-Disposition: inline In-Reply-To: <20061027213034.GD98266@gizmo.acns.msu.edu> User-Agent: Mutt/1.5.13 (2006-08-11) Cc: Noah , freebsd-questions@freebsd.org Subject: Re: replacing ^M with emacs X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2006 01:20:49 -0000 On Fri, Oct 27, 2006 at 05:30:34PM -0400, Jerry McAllister wrote: > On Fri, Oct 27, 2006 at 12:26:25PM -0700, Noah wrote: > > > Hi there, > > > > It appears that a text editor placed a bunch on ^M throughout a text > > file I am working with. I assure this is equivalent to eh keystroke > > control-M. > > This is probably "MS-DOS" type text file. MS text file lines > all end in a CR-LF character pair whereas UNIX text file lines > have only a LF (line feed) and the end of each line. > All text editors on MS systems do that and if you do a binary transfer > of a file from MS to UNIX you will get all the extra ^M characters > showing up. most versions of ftp have an ASCII mode that will > do the conversion for you as you transfer the file back and forth > between MS and UNIX. I think SCP only does binary transfers. > > I am not an Emacs user, but, > You can easily use tr(1) to remove all the ^M characters from a > file. tr -r "\r" goodfile > where badfile is the one with the ^M characters and goodfile is > the newly cleaned copy. The only anoying thing is having to > write to a second file and then get rid of the first or mv the > new one back to the old (as in: mv goodfile badfile after doing > the tr. > > ////jerry > I think there is something similar in emacs by using the set-buffer-file-coding-system (binded at C-x RET f in default configurations). So to "cure" and succesfully "convert" DOS files into unix format, i use C-x RET f unix RET.