3

I want everything else to remain identical, only have uppercase letters come first.

user2958725
  • 1,355
  • 3
  • 12
  • 16

1 Answers1

7

This may be mostly a locale issue. If you don't need anything specific to your locale (and want your script to work the same on different systems), you may reset LC_COLLATE like this:

$ echo -e "foo\nFoo" | LC_COLLATE=C sort
Foo
foo

You may also set LC_COLLATE for the whole life-time of your script if you don't need any locale-specific collations anywhere:

export LC_COLLATE=C
Michał Górny
  • 18,713
  • 5
  • 53
  • 76