Bug 1255107 - Sort command sorts on the whole line when it should sort on first column.
Sort command sorts on the whole line when it should sort on first column.
Status: CLOSED DUPLICATE of bug 1148347
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: coreutils (Show other bugs)
x86_64 Linux
unspecified Severity high
: rc
: ---
Assigned To: Ondrej Vasik
Depends On:
  Show dependency treegraph
Reported: 2015-08-19 12:12 EDT by Ashkan
Modified: 2015-08-19 16:30 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-08-19 16:30:13 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
CentOS 9289 None None None Never

  None (edit)
Description Ashkan 2015-08-19 12:12:41 EDT
Description of problem:
While sorting files, sometimes sort command sorts the whole line even if it is used like sort -k1,1 and there are spaces in the file.

Version-Release number of selected component (if applicable):

How reproducible:
Always reproducible

Steps to Reproduce:
Create a file with this content:

Another file with this content:
a 1
b 0
B 1
A 0

Use sort -k1,1 filename to sort the files the first one results in

Actual results:
sorting result of first file:

sorting result of second file:
A 0
a 1
b 0
B 1

Expected results:
Note that in the first result a is before A and in the second a is after A. It shouldn't be different. Either the first result should be:

Or the second result should be:
a 1
A 0
b 0
B 1

It just needed to be consistent across both files.

Additional info:
sort version: 8.22
LC_COLLATE is not set.
LC_ALL is not set.
LANG is set to en_US.UTF-8
LC_CTYPE is not set.
Comment 2 Ondrej Vasik 2015-08-19 16:30:13 EDT
I believe this is a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1148347 .
Actually, when using LC_ALL=C sort , you will get consistent sort results even with current coreutils (however, different from your expectations).

*** This bug has been marked as a duplicate of bug 1148347 ***

Note You need to log in before you can comment on or make changes to this bug.