Hi,

If there is only one column in the input, then an out-of-range field
spec will result in the print of the whole line.

$ cut -f 3 <<< $'a' | xxd
0000000: 610a                                     a.

Otherwise, an empty string is printed.

$ cut -f 3 <<< $'a\tb' | xxd
0000000: 0a                                       .

This is counter-intuitive. I think that one-field input should not be
treated specially. It should still result in no output for an
out-of-range field spec.

Is there a strong reason why `cut` should treat one-field input
different? (What if users do want empty string be printed for
out-of-range field even for one-field input?) Or this should be
considered as a bug?

-- 
Regards,
Peng

Reply via email to