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"



_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to