Vim Sorts files by field

Source: Internet
Author: User
Tags sorts

Suppose you have the following data, separated by a space for the data column:

1   Hevichuan   124.63     172  0.722   Zhang Ziyin   99.67      172  0.583   Week Guang bin   93.34      188  0.504   Chen Xingdong     41.86      188  0.225 &nbsp ; She Yongchen   26.68      188  0.146   Teo Eng Hock   18.25      188  0.107   Li Huatian   18.25      188  0.108   Ge Xiang Camp   11.89      164  0.079   Wang Tianmin &NB Sp -16.55     156  -0.1110 Liu Feng     -16.19      -0.1111 Cattaneo hillock   -86.73   &N Bsp  -0.5712 Yang June     -213.45    152  -1.40  If we want to sort by the 4th column of data, we can do so in vim: 1,12!sort-r-N- K4.1,5 -r is a descending sort-n is sorted by numeric size-K, which is sorted according to that field, 4.1, indicates the first character of the 4th column starts, 5 means to the 5th field ending-T followed by a delimiter, the default is a space   run after data as follows: 7   Li Huatian   18.25      188  0.106   Teo Eng Hock   18.25      188  0.105   She Yongchen &nbs P 26.68      188  0.144   Chen Xingdong     41.86      188  0.223   Zhou Guangma   93.34   &NBS P  188  0.502   Zhang Ziyin   99.67      172  0.581   Hevichuan   124.63     172  0.728   Ge Xiang Camp   11.89      164  0.079   Wang Tianmin   -16.55     156  -0 .1112 Yang June     -213.45    152  -1.4011 Cattaneo hillock   -86.73      -0.5710 Liu Feng     -16.19     $  -0.11  from: http://blog.sina.com.cn/s/blog_4b1816550100k2ec.html

Vim sorts files by field

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.