The little things give you away... A collection of various small helper stuff
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

14 linhas
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