LoginSignup
2
1

More than 1 year has passed since last update.

uniqコマンド基本

Posted at

uniqコマンドについて確認

テスト用のファイルを用意

# cat file
aaa
aaa
bbb
ccc
ddd
ddd

オプションなしでコマンド実行すると重複行は一つの行にまとめられる

# uniq file
aaa
bbb
ccc
ddd

-uオプションを使用してコマンドを実行すると重複していない行のみ表示される

# uniq -u file
bbb
ccc

-dオプションを使用してコマンドを実行すると重複している行のみ表示される

# uniq -d file
aaa
ddd
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