Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Aug 2000 16:35:31 -0400
From:      Neill Robins <freebsd@nc.rr.com>
To:        Erik Trulsson <ertr1013@student.uu.se>
Cc:        Nathan Vidican <webmaster@wmptl.com>, questions@freebsd.org
Subject:   Re: Windows ASCII files -> Unix ASCII Files
Message-ID:  <20162945762.20000808163531@nc.rr.com>
In-Reply-To: <20000808222146.A3443@student.uu.se>
References:  <399069B1.1AB04AFF@wmptl.com> <20000808222146.A3443@student.uu.se>

next in thread | previous in thread | raw e-mail | index | archive | help
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" <filenames>
   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 <filename1> | tr -d "^V^M" > <newfile>
   sed -e "s/^V^M//" <filename> > <output filename>
   -- 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20162945762.20000808163531>