The little things give you away... A collection of various small helper stuff
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

14 行
431 B

  1. #!/bin/bash
  2. if [[ "$1" != "-c" ]]
  3. then
  4. # Without count (preserving order, printing the first appearance)
  5. # In this case, Perl is *much* faster than AWK.
  6. perl -ne 'print if ! $a{$_}++'
  7. #awk '!seen[$0]++'
  8. else
  9. # With count (order undefined)
  10. # Here, AWK is significantly faster.
  11. #perl -e 'while (<>) { $a{$_}++; } foreach $key (keys %a) { print "$a{$key} $key"; }'
  12. awk '{ tot[$0]++ } END { for (i in tot) print tot[i],i }'
  13. fi