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 > 2,3,5 > > $ echo 1,2,3,4,5,6 | cut -d, -f3,5,2 -o > 3,5,2 > Should this be extended to character output as well? > echo output | cut -c6,4,2 -o > tpu >
Absolutely! It would be expected behavior (IMHO). I see no reason not to. 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: CUT_OPTIONS=-o --Ken Nellis