why does "cut" print fields in original order?

Ed Greshko Ed.Greshko at greshko.com
Wed Nov 21 06:39:08 UTC 2007


Robert P. J. Day wrote:
>   nitpicky, yes, but it occasionally irritates me that "cut" will
> print fields, not in the order you specify them with the "-f" option,
> but in the original order in the source text, to wit:
> 
> $ cut -d: -f1,7 /etc/passwd
> root:/bin/bash
> bin:/sbin/nologin
> daemon:/sbin/nologin
> ...
> 
> $ cut -fd: -f7,1 /etc/passwd
> root:/bin/bash
> bin:/sbin/nologin
> daemon:/sbin/nologin
> ...
> 
>   is there really a reason that cut refuses to acknowledge the order
> of the fields as supplied by the user?  some historical reason,
> perhaps, that we can now all make fun of and wonder what they were
> smoking at the time?

I don't see any indication from the man page that would lead one to believe
that cut will print in the order listed.  I think you are simply implying a
behavior that was never intended.




More information about the fedora-list mailing list