[Top][All Lists]

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

RE: coreutils feature requests?

From: Kaz Kylheku (Coreutils)
Subject: RE: coreutils feature requests?
Date: Wed, 19 Jul 2017 07:21:33 -0700
User-agent: Roundcube Webmail/0.9.2

On 19.07.2017 06:29, Nellis, Kenneth wrote:
From: Steeve McCauley
I can't believe I'd never thought of reordering output columns like this.  FWIW, I agree that another option should be used to prevent issues with backward compatibility.

$ echo 1,2,3,4,5,6 | cut -d, -f3,5,2

$ echo 1,2,3,4,5,6 | cut -d, -f3,5,2 -o
Should this be extended to character output as well?
echo output | cut -c6,4,2 -o

Absolutely! It would be expected behavior (IMHO). I see no reason not to.

POSIX expends considerable text in requiring that the fields constitute
a set, and are de-duplicated and put into order. (Quoted in earlier
message.) So indeed, the behavior cannot just be changed to match the
QNX "cut", not just because of backward compatibility (always the primary
concern) but standard conformance also (close second).

QNX has a conformance bug here. I wouldn't continue to rely on it.

In addition, so that scripts can work across platforms, I (strongly) recommend that a cut-specific environment variable be defined to allow specifying the field ordering behavior. In that way my QNX 4 script (whose cut would balk at
the -o option) would work with Gnu. One possibility:

On the other hand, I hope I'm not alone in behind opposed to introducing
new global variables which alter language or tool semantics.

Scripts can target multiple implementations of a command by defining a
wrapping function rather than a magic global variable.

A portable script cannot rely on cut having order-preserving fields anyway.

Everyone in POSIX-land implementing different features and then using
a zoo of environment variables to emulate each other's features and
quirks would be unmanageable.

reply via email to

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