Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am highly frustrated by the behaviour of the standard unix sort command, which seems to always sort on all fields of a line, even if I specify one field to sort on.
If input of sort is like:
ON user2
OFF user2
ON user1
'cat input | sort +1' will always produce the following output:
ON user1
OFF user2
ON user2
Note that the output is also sorted on field0, though noone told sort to sort on field0.
Is there a way to tell sort not to sort on a specific field, i.e. leaving the lines in the positional order, instead?
My intention is that the sort output should be like this:
ON user1
ON user2
OFF user2
(i.e. it is not sorted on field0, only on field1)
Thank you for the tips, both worked.
I already tried out a sort -k command, which (now I know) did not work as I thought the first data is field 0, the second is field 1, so tried sort -k 1,1 and dropped the idea when it did not work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.