LoginSignup
13
11

More than 5 years have passed since last update.

MeCabで名詞抽出してカウントするワンライナー

Posted at

よく忘れるのでメモ。

input.txt
犬も歩けば棒に当たる
夫婦喧嘩は犬も食わぬ
犬が西向きゃ尾は東
$ cat input.txt | mecab | grep $"\t名詞" | cut -f1 | sort | uniq -c | sort -nr

   3 犬
   1 夫婦
   1 喧嘩
   1 西
   1 棒
   1 東
   1 尾
13
11
1

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
13
11