LoginSignup
1
0

More than 1 year has passed since last update.

テキストファイル内の文字列の重複を無視したい(コマンドライン操作から)

Posted at

コマンドライン操作からテキストファイル内の文字列の重複を無視したい場合は、sortuniqを組み合わせればOK

以下のようなテキストファイルがある場合

$ cat test.txt 
hoge
fuga
hoge
fuga
piyo
hoge
fuga
piyo
hoge
fuga
piyo

以下のようにsortuniqを組み合わせて実行すればOK

$ sort test.txt | uniq
fuga
hoge
piyo

参考

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