tr(Unixコマンド)の-cオプションを理解するのに問題があります。
このフォーマットを見てtr
ください:tr [Options] set1 [set2]
これは、「set1の補数(つまり、set1にないすべての文字)を使用する」という意味-c
の[オプション]であると理解しています。ただし、このコマンドの使用方法の例を挙げて、利点を説明してください。tr
ありがとうございました
It means to complement the character range. When you complement the string A-Z
you get Any character that is not in A ... Z.
Sometimes it is much easier to specify a task with the complement. Suppose you want to count the number of semicolons in a C source file. You delete all non-semicolons and count what's left:
tr -d -c \; < file.c | wc -c