bug-coreutils
[Top][All Lists]
Advanced

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

Re: include dos2unix/unix2dos in coreutils ?


From: Matthew Woehlke
Subject: Re: include dos2unix/unix2dos in coreutils ?
Date: Mon, 13 Nov 2006 10:56:47 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.0

Alfred M. Szmidt wrote:
Well, then, whichever way. We're drifting off the original topic,
which was 'should d2u-and-friends (or equivalents) be added to
coreutils?'.  Can we address Mike's original question now, before
he gets completely discouraged by this side-track? :-)

Personally, I think dos2unix is such a simple and seldom used hack
to write in one line of sed that I don't see the point of it being
included[0].

Actually, dos2unix (the one I have, anyway) *does* do a few things that aren't so trivially done with sed. For one, it is in-place (unless told otherwise), and has --keepdate. In-place is awkward to do with sed.

Of course, you can also do "cat <file> | tr -d '\r'", which may or may not handle things like '\r\r\n' the way you want. These sorts of corner cases are one place where a special-purpose utility can be better-behaved than a hack using sed or tr.

Also, should other types of line-endings be handled?  Like for example
CR-only line-endings (old Mac format IIRC).

I think I answered that ("yes: {DOS, Unix, Mac}, from any, to any") before we drifted off-topic. :-)

[0]: Many of the things in coreutils can be written using one line of
sed, like tac, basename, dirname, but these are much more general
tools than dos2unix; compare the number of times you do dirname or tac
with dos2unix.  IMHO.

Wow, that was a TERRIBLE example! ;-) I've used dos2unix enough to be annoyed by its lack of pervasiveness, but I don't know that I've *ever* used dirname (maybe 'basename', and only in scripts). To use your argument, dirname (and basename) is a simple hack that can be written as a trivial bash substitution. :-) Does that mean dirname should not be in coreutils?

--
Matthew
$ kill bill
kill: can't find process "bill"





reply via email to

[Prev in Thread] Current Thread [Next in Thread]