0

I tried command 'sort' in two virtual machines, but one gave all upper-case words before all lower-case words, and another sort in an ignore-case way.

Not ignore case:

[@sjs_100_189 tanglianrui]# sort test.txt 
A
T
a
b
t

Ignore case:

[@sjs_88_171 sortedOutput]# sort -f test.txt 
a
A
c
t
T

I'd like to know if there is a config file controlling the behavior of sort? If so, which one is it and how to config it? Thank you so much.

Charles Duffy
  • 280,126
  • 43
  • 390
  • 441
LittleSoup
  • 31
  • 1
  • 3
  • FYI, `sort` is not actually part of bash, and behaves identically no matter which shell it's started from or if it's run without any shell involved as all -- it's better tagged as `unix`. – Charles Duffy Jul 17 '17 at 03:47
  • As for your immediate question, look at the configured character collation order (`LC_COLLATE`, or, if that's not defined, `LC_ALL`). If you want simple ASCII sorting, `export LC_COLLATE=C` is appropriate. – Charles Duffy Jul 17 '17 at 03:48

0 Answers0