Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Nedeľa, 25. október 2026

Rozdiely pre scripts/shell/getmails/getmails.sh medzi verziami 1.3 a 1.4

verzia 1.3, 2002/02/12 00:34:25 verzia 1.4, 2002/06/18 18:24:38
Riadok 18 
Riadok 18 
 # ak vlavo od znaku @ je viac ako 6 cisiel, adresa je neplatna  # ak vlavo od znaku @ je viac ako 6 cisiel, adresa je neplatna
 # domena je max 3 znakova a min 2 znakova a obsahovat moze iba pismena  # domena je max 3 znakova a min 2 znakova a obsahovat moze iba pismena
   
   # filter with awk {{{
   use_awk()
   {
   awk '
   BEGIN {
           OFS="\n"
   }
   // { $0 = tolower($0); }        # convert char. to lowercase
   
   /message-id:/  { next; }        # ignore lines matching this
   /content-id:/  { next; }        # ignore lines matching this
   /received:/    { next; }        # ignore lines matching this
   /in-reply-to:/ { next; }        # ignore lines matching this
   /references:/  { next; }        # ignore lines matching this
   /^[ \t]*id /   { next; }        # ignore lines matching this
   
   /@/ {   # lines containing @
           fields = split ($0, array, /[^a-z0-9@\.-]+/);
           for (i=1; i<= fields; i++) {    # go over all fields
                   if (match(array[i], /^([^\.]+\.[^\.]+|[^\.]+)@(([^\.]+\.)+)[a-z][a-z][a-z]?$/))
                           print array[i];
           }
   }
   ' \
   | sort -u
   }
   # }}}
   
   # filter with grep, tr, sed {{{
   use_grep()
   {
 grep -i -v "Message-ID:" \  grep -i -v "Message-ID:" \
 | grep -i -v "Content-ID:" \  | grep -i -v "Content-ID:" \
 | grep -i -v "Received:" \  | grep -i -v "Received:" \
Riadok 29  grep -i -v "Message-ID:" \
Riadok 60  grep -i -v "Message-ID:" \
 | sed 's/[^a-z]*$//' \  | sed 's/[^a-z]*$//' \
 | grep @ \  | grep @ \
 | grep -E -v '^.*([0-9].*){6,}.*[@].*$' \  | grep -E -v '^.*([0-9].*){6,}.*[@].*$' \
 | grep -E "^([^\.]+\.[^\.]+|[^\.]+)[@]([^\.]+\.){1,}[a-z][a-z][a-z]?$"  | grep -E "^([^\.]+\.[^\.]+|[^\.]+)[@]([^\.]+\.){1,}[a-z][a-z][a-z]?$" \
   | sort -u
   }
   # }}}
   
   # functions for testing speed {{{
   test_awk()
   {
           for i in 1 2 3 4 5 6 7 8 9 10;
           do
                   cat ~/mbox | use_awk > /dev/null;
           done
   }
   
   test_grep()
   {
           for i in 1 2 3 4 5 6 7 8 9 10;
           do
                   cat ~/mbox | use_grep > /dev/null;
           done
   }
   
   make_test()
   {
           echo "testing use_awk: "; time test_awk;  echo; echo;
           echo "testing use_grep:"; time test_grep; echo; echo;
   }
   
   # }}}
   
   # Please specifi, which util you will use
   use_awk
   #use_grep
   
   
   ###################################################################
   # TEST:
   # use_awk:   0.56s user 0.16s system 62% cpu 1.149 total
   # use_grep:  3.56s user 0.84s system 61% cpu 7.174 total
   # RESULT: use_awk is 6.24 fastes as use_grep
   
   
   # Modeline {{{
   # vim:set ts=4:
   # vim600:fdm=marker fdl=0 fdc=3 vb t_vb=:
   # }}}

Legend:
Odstranené z verzie1.3  
zmenené riadky
  Pridané vo verzii1.4

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok