What does -f mean with Sort?

1.2k views Asked by At

I've been looking over documentation of the Bash system, and I simply have not found an answer to this, that makes sense.

Since notations give different meaning in different contexts - What does the -f stand for, in the following command?

sort -m -f <(grep "[^A-Z]..$" memo1 | sort) <(grep ".*aba.*" memo2 |sort)

I understand the sorting, the merge, the redirection of output and the Grep running regex patterns on memo1 and memo2 respectively.

But what does the -f do?

1

There are 1 answers

3
Eric Duminil On
man sort | grep "\-f" 

returns :

-f, --ignore-case

Note that on Ubuntu and derivatives, the LC_COLLATE environment variable is a case-insensitive collation.

It means that sort and sort -f are equivalent on those platforms when LC_COLLATE isn't changed :

echo "B\nA\nb\na\nC" | sort
a
A
b
B
C

echo "B\nA\nb\na\nC" | sort -f
a
A
b
B
C

echo "B\nA\nb\na\nC" |  LC_COLLATE=C sort # <- If you need case sensitive sort.
A
B
C
a
b