[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: newbie tip



>>>>> "will" == will trillich <will@serensoft.com> writes:

    will> look -- an objection! it's about time...
    will> On Fri, Jun 29, 2001 at 02:21:13PM +0200, Carel Fellinger wrote:
    >> On Thu, Jun 28, 2001 at 10:03:15PM -0500, will trillich wrote:
    >> ...
    >> > -- 
    >> > DEBIAN NEWBIE TIP #56 from Vineet Kumar <debian-user@virtual.doorstop.net> 
    >> > :
    >> > Troubled by DOS-FORMAT OR MAC-FORMAT TEXT FILES? Here's another
    >> > way to deal with those troublesome ^M characters: a simple
    >> > 	tr -d '\015' < dos.file
    >> > should do the trick.  While we're on the subject, a Mac file
    >> > can be converted with
    >> > 	tr '\015' '\012' < mac.file
    >> > You can do all your CR/LF translations with tr as long as you
    >> > can remember that macs use CRs, *nices use LFs, and DOS uses
    >> > CRLF.
    >> 
    >> I object to classifying this as a NEWBIE tip:) There are better and
    >> simpler ways to achieve this, the tip as is will only scare people,
    >> fails to deal with the eof char, and doesn't *replace* the original
    >> file (the thing newbies are likely to expect).  Better advice to use
    >> one of the many special programs for this simply task.

Agreed.  And it doesn't convert CRLF to LF, it simply kills any CR.
;-)

    will> i do have other tips that deal with this snag (some perl, some
    will> vim) -- and if you'd like to recommend a different solution, i'd
    will> be delighted to include it in my list (properly attributed, of
    will> course)...

dos2unix from sysutils.  (No Mac conversion, however... but then
again, most people need to convert MS-DOS files anyway).

Never used anything else, and certainly wouldn't use tr for this.
dos2unix is a lot simpler than this tr solution... "dos2unix
dos.file", done.  (Of course you might have this in your list
already...)

Alternatively, mention recode.  But... that's lots more powerful, and
thus a lot more complicated.  (You *could* mention recode in a short
sentence "For universal recoding problems, there's recode" or
s.th. like that.  *Pointers* to advanced tools/topics are a good
thing, IMHO... always give people the option to learn.  It's not our
fault if people don't learn... but it is our fault if we don't show
them where they can).

Bye, J

-- 
 Jürgen A. Erhard  (juergen.erhard@gmx.net, jae@users.sourceforge.net)
          My WebHome: http://members.tripod.com/Juergen_Erhard
              Linux - Free PC Unix (http://www.linux.org)
   "No matter how cynical I get, I can't keep up."  -- Bruce Schneier

Attachment: pgpjRuM0PVfwF.pgp
Description: PGP signature


Reply to: