开发者

linux sort only by the first letter of each line

what's the fastest way to sort file by the first letter of each line? should one use linux sort command or are there other more efficient alternatives? if I am using sort, how do I sort 开发者_高级运维only by the first letter and ignore the rest?


This will sort by the first character

sort -k1.1,1.1 filename

add -s if you want to preserve the input order of lines with the same first character

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜