Re: off topic: sort problem

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

 



After reading the  man more carefully, an end position should be 
specified for the key:

"KEYDEF  is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where
F is a field number and C a character position in the field;  both  are
origin 1, and the stop position defaults to the line's end."

Hence

cat junk
AA|def
A|xyz

cat junk | sort -k1,1 -t"|"         # 1=start position, 1=end position
A|xyz
AA|def

It's all good now.


On Wed, 21 Nov 2018 21:47:24 +0000, Amadeus WM wrote:

> I've been using sort for years and I just ran into something I've never
> seen and I can't explain.
> 
> cat spam AA|3334 A|3826
> 
> cat spam | sort -k1 -t"|"              # this works!
> A|3826 AA|3334
> 
> 
> Now
> 
> cat junk AA|def A|xyz
> 
> cat junk | sort -k1 -t"|"              # this doesn't AA|def A|xyz
> 
> The two files spam and junk have the exact same first column, but one
> gets sorted, the other doesn't. What am I missing?
> 
> Thanks!
> 
> _______________________________________________
> users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send
> an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct:
> https://getfedora.org/code-of-conduct.html List Guidelines:
> https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives:
> https://lists.fedoraproject.org/archives/list/
users@xxxxxxxxxxxxxxxxxxxxxxx

_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux