Mikael Ascended Rusin
Mikael Ascended Rusin

Reputation: 45

What does -f mean with Sort?

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?

Upvotes: 1

Views: 1377

Answers (1)

Eric Duminil
Eric Duminil

Reputation: 54303

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

Upvotes: 2

Related Questions