2
1

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.

ファイル行数をソートする方法

Last updated at Posted at 2016-05-21
$ ls *ascii* | xargs wc -l | sort -nk1
      19 summary.asciidoc
      30 index.asciidoc
     154 ch00.asciidoc
     973 ch06.asciidoc
    1098 ch04.asciidoc
    1154 ch09.asciidoc
    1330 ch10.asciidoc
    1433 ch02.asciidoc
    1465 ch07.asciidoc
    1602 ch01.asciidoc
    1786 ch05.asciidoc
    1889 ch08.asciidoc
    1976 ch03.asciidoc
   14909 total

sort -nk1のオプション:

  • n : 数値型でソートする(Number)
  • k1: Key1をソートする
  • r: 逆順でソートする

なと、区切りは空白ではない場合、-tが役に立ちます。

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?