Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

After some time spent experimenting with unix sort I have noticed the following behaviour

files.list:

betty
./adam
./cyril

The result of sort files.list is the same as the result of sort -d files.list:

./adam
betty
./cyril

The manual page for sort reads:

sort [OPTION]... [FILE]...

-d, --dictionary-order
          consider only blanks and alphanumeric characters

But it seems that my sort (GNU coreutils 8.17) behaves as if -d were default. However, I have not found a way to turn it off.

So my question is, is there any difference when invoking sort with or without -d? Is it possible to make sort not to ignore nonalphanumeric characters?

share|improve this question

migrated from stackoverflow.com Sep 18 '12 at 8:12

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

up vote 2 down vote accepted

What's your LANG environment variable set to?

If it isn't C, try running:

LANG=C sort    files.list > c.files.list 
LANG=C sort -d files.list > c-d.files.list 

and compare the output files with each other and with your original outputs. You should get the same effect if you set LANG=POSIX, too.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.