Why does 'sort' ignore special characters, like the asterisk?

Posted by Aaron Digulla on Super User See other posts from Super User or by Aaron Digulla
Published on 2010-12-28T11:21:10Z Indexed on 2010/12/28 11:55 UTC
Read the original article Hit count: 275

Filed under:

I thought that sort would sort common prefixes together but that doesn't always happen. Take this input for example:

AT0S*eightieths
AT0S*eyetooth's
AT*ad
AT*Ad
AT*AD
AT*Eydie
AT*eyed
ATF*adv
ATF*ATV
ATF*edify
ATF*Ediva
ATFKT*advocate
ATFKTNK*advocating
ATFKT*outfought
ATFKTS*advocates
ATHT*whitehead
ATHT*Whitehead
AT*id
AT*I'd
AT*Ito
AT*IUD
ATJ*adage
ATNXNS*attention's
ATNXNS*attenuation's
ATNXNS*autoignition's
AT*oat
AT*OD
AT*outweigh
AT*owed
ATP0K*idiopathic
ATP*adobe
ATT*wighted
ATT*witted
ATT*wooded
AT*UT
AT*Uta
AT*wowed
AT*Wyatt
ATX*atishoo

After sort, I'd expect all the AT* to end up in one chunk but when you run this data through sort, the output == input. Why is that? I'm not specifying any option to ignore non-alphabetic characters or anything. Just sort dict > out.

My version of sort comes from coreutils 8.5-1ubuntu3.

© Super User or respective owner

Related posts about sort