0
0

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.

uniqコマンドの現実

Last updated at Posted at 2017-04-07
$ wc -l ok.csv
13773

のok.csvを

$ uniq ok.csv > ok_uniq.csv
$ wc -l ok_uniq.csv
13562

$ uniq -d ok.csv > ok_repeated.csv
$ wc -l ok_repeated.csv
197

13773 - 13562 = 211
211 - 197 = 14

14行はどこへ行った?
結論から言うとダブりが3行あると1行はどちらにも入らずに消えているみたいですね。
3行ダブりが14回ほど3行ダブりが12回、4行ダブりが1回あったみたいです。

2行ダブりはuniq.csv, repeated.csvのどちらにも1行入るように振り分けられ、
3行ダブりはどちらにも1行入って、どちらにも入らずに1行が消えていく。
4行ダブりでも、1行がどちらにも入らずに消えているようで、1行がuniqとして、2行が2行がどちらにも入らずに消えて、1行がuniq.csvへ入り、1行がrepeat.csvへ入ります。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?