shell sort

sort is awesome!

22 hpp_national:talk:recentAtUsers-64490

23 hpp_national:talk:site_online_users:178494

34 hpp_national:talk:site_online_users:231533

22 hpp_national:talk:praiseTopic-609af190-1dd5-11b2-b06b-a19c5cd49a7a

22 hpp_national:talk:liaoba-2115

16 hpp_national:talk:reprintLiaobaId-5b9dc050-1dd5-11b2-8fd0-81439be9c068

23 hpp_national:talk:praiseTopic-5d247660-1dd5-11b2-8f13-43fc564d8a0a

52 hpp_national:talk:countTopicId-290716

22 hpp_national:talk:visit-254188

52 hpp_national:talk:atMytopic_replied_floor-219652

56 hpp_national:talk:getTopicIdNew-106134

52 hpp_national:talk:atMytopic_replied_floor-294624

34 hpp_national:talk:site_online_users:128886

23 hpp_national:talk:site_online_users:216370

22 hpp_national:talk:visit-214469

3577 hpp_national:talk:countTopicId-133007

23 hpp_national:talk:praiseTopic-5d2ad9e0-1dd5-11b2-a907-1f3d2c4b8d57

23 hpp_national:talk:site_online_users:182704

23 hpp_national:talk:praiseTopic-5ff08430-1dd5-11b2-81e3-ad9b2654a4e0

773 hpp_national:talk:enjoyTopic-234969

..................

使用空格作为分隔符的一个文本,13万条记录,想要以第一列的值倒序排列:

#-t是分隔符,中间不能有空格

#-k是列,不能有空格,

#1nr,表示第1列以number_sort方式reverse倒序排列

sort -t" " -k1,1nr source.txt>dest.txt

13万记录,3妙搞定!!

你可能感兴趣的:(shell)