linux - GNU sort - What is the default algorithm used for comparison? -
i need understanding default algorithm gnu's sort. assumed did lexicographic sort, found out behavior not correspond that, example take following strings:
alex. alex.a alex.z alexa alex0 alexz alex.~ alex alex.| alex.} alex.abc
and sort them on shell using sort echo 'stuff' | sort
this result get:
alex alex. alex.~ alex.| alex.} alex0 alexa alex.a alex.abc alexz alex.z
and can't figure out why alex0
, alexa
appear in between alex.}
, alex.a
can explain me?
sorting , large depends on locale settings:
$ sort sort alex alex. alex.~ alex.| alex.} alex0 alexa alex.a alex.abc alexz alex.z $ lc_all=c sort sort alex alex. alex.z alex.a alex.abc alex.| alex.} alex.~ alex0 alexz alexa
Comments
Post a Comment