Re: why does "cut" print fields in original order?

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

 



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.

i understand that that's not indicated on the man page.  on the other
hand, is there any reason that it *wasn't* done that way?  it would
seem that that would be an obvious enhancement and, certainly, that
would be more intuitive behaviour, no?

You need  some reason to type:
sed -e 's/\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\):\(.*\)/\7:\1/'

--
  Les Mikesell
   lesmikesell@xxxxxxxxx

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux