WAVE Log
uniq

連続する同じ内容の行をまとめる

連続する同じ行がある場合それらを削除して表示することができる。
オプションを使用することで、いろいろな表示方法を選べる。

# cat sample.txt Hello World ! Hello World ! Hello World ! Hello World ! How are you ?

に対して
連続する行をまとめて表示

# uniq sample.txt Hello World ! How are you ?

連続する同じ行がいくつあるか表示

# uniq -c sample.txt 4 Hello World ! 1 How are you ?

連続する同じ行のみ表示

# uniq -d sample.txt Hello World !

1度しか現れない行のみ表示

# uniq -u sample.txt How are you ?