I am trying to use the answer in GNU Sort by case-sensitive to sort a file in my Mac OS.
My file.txt
looks like this:
"Best"
"A"
"BEST"
In the second answer to the mentioned question, it says that one can do:
echo -e "d\nD\nc\nb\nB\na" | sort --ignore-case file.txt
and the output should be:
"A"
"Best"
"BEST"
However, when I do it in my computer, I get:
"A"
"BEST"
"Best"
It does not matter if I use the --ignore-case
or not, the output is the same.
Maybe LC_COLLATE=C
can not be set in Mac OS?
Does someone know how to use sort
and have lowercase < uppercase in Mac OS?
EDIT
@jaume recommended installing coreutils
and using the GNU sort. I tried brew install coreutils
and then gsort -f file.txt
but still had no luck.