4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vim - sort

Last updated at Posted at 2015-10-20

外部 sort コマンド (:%!sort)

区切りを「,」として2番目のフィールドでソートする
:%!sort -t, -k 2,2
3番目のフィールドの値を数値として解釈し、かつ、降順でソートする
:%!sort -t, -k 3,3nr
データを空白文字で区切って、2番目のフィールドの値でソートする
:%!sort -b -k 2,2
区切りを「,」として、3番目のフィールドでソートし、同じであれば、4番目のフィールドでソートする
:%!sort -k 3,3n -k 4,4n

内部sortコマンド (:sort で呼び出す)

降順
:sort!
範囲指定
:10,30sort
大小文字区別なし
:sort i
10、16、8進数
:sort n
:sort x
:sort o
20列目の値を基準にソートする。+10進数でソートの場合
:sort /%20c/
:sort n /%20c/

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?