How to sort on column for rows containing a certain word

前端 未结 4 960
耶瑟儿~
耶瑟儿~ 2021-02-02 18:32

I want to sort on a certain column only for rows containing a certain word. I don\'t want to see rows not containing that word. For example I have this text file:



        
4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-02 18:53

    2 vim commands:

    :v/sdf/d
    :sort n /[^[:digit:]]*/
    
    • first deletes all lines that do not contain 'sdf'
    • second sorts numbers ignoring non-numbers

提交回复
热议问题