From owner-freebsd-questions Tue Aug 8 13:35:39 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mail3.nc.rr.com (fe3.southeast.rr.com [24.93.67.50]) by hub.freebsd.org (Postfix) with ESMTP id 39CE437BA14 for ; Tue, 8 Aug 2000 13:35:28 -0700 (PDT) (envelope-from freebsd@nc.rr.com) Received: from rdu25-30-217.nc.rr.com ([24.25.30.217]) by mail3.nc.rr.com with Microsoft SMTPSVC(5.5.1877.357.35); Tue, 8 Aug 2000 16:35:22 -0400 Date: Tue, 8 Aug 2000 16:35:31 -0400 From: Neill Robins X-Mailer: The Bat! (v1.42f) UNREG / CD5BF9353B3B7091 Reply-To: Neill Robins X-Priority: 3 (Normal) Message-ID: <20162945762.20000808163531@nc.rr.com> To: Erik Trulsson Cc: Nathan Vidican , questions@freebsd.org Subject: Re: Windows ASCII files -> Unix ASCII Files In-reply-To: <20000808222146.A3443@student.uu.se> References: <399069B1.1AB04AFF@wmptl.com> <20000808222146.A3443@student.uu.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Tuesday, August 08, 2000, 4:21:46 PM, you wrote: ET> On Tue, Aug 08, 2000 at 04:12:33PM -0400, Nathan Vidican wrote: >> Is there any sort of utility to rip the ^M characters from the end of >> each line in an ASCII text file as produced by Windows? I've tried using >> a simple regexp with perl, as well as using chop/chomp, but niether seem >> to work, any ideas? >> >> >> I figure there has got to be some easy way of doing this? Right now >> we're FTP get/binary, then FTP put/ASCII 'ing in order to convert; which >> needless to say is a pain in the neck. >> Any ideas or suggestions would be helpful. >> ET> Why not use tr(1)? ET> Example: ET> tr -d '\r' < infile > outfile ET> That is probably the simplest soulution. (These are all quoted from a discussion on Aug 1st on -questions) Or: flip -u Or: you can do this within vi :g/(Ctrl-V)(Ctrl-M)/s/// Or: perl -pi -e "s:^V^M::g" where ^V and ^M are actually the control chars, not the meta-chars! or, you can do any of these (non-meta char rule still applies); cat | tr -d "^V^M" > sed -e "s/^V^M//" > -- and in vi you can: 1) hit the ESC key 2) :%s/^V^M// Or: in vi :%s/^M//g Or: open it up in pico and save it -- Best regards, Neill freebsd@nc.rr.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message