Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

up vote 3 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .