Bob Miller wrote:
<snipped>>

Finally, you can put all that into a shell script so you
never have to type it again.

    $ cat > bin/tophosts
    #!/bin/sh
    sed -rn 's/.*[^0-9]([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/p' ${1+"$@"} |
        uniq -c |
            sort -n |
                tail -n 20 |
                    sed -r 's/(.*) (.*)/echo \1 \2 `host \2`/' |
                        sh |
         awk '/NXDOMAIN/ { print $1, $2 } !/NXDOMAIN/ { print $1, $NF }'
    ^D
    $ chmod +x bin/tophosts
    $ tophosts
    30 216-210-236-195.atgi.net.
    31 host248.orcasinc.com.
    31 211.101.226.193
    36 host248.orcasinc.com.
    36 relato.pro.br.
        ... et cetera ...

Whose turn is it to advocate Python today?


Thanks Bob...

I can't get this to work just yet, but I'll play with it some more...

Question (remember - I'm stoopid): where is this script getting the IP addresses from? I don't understand the first part of:

  $ sub='s/.*[^0-9]([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/p'
  $ sed -rn "$sub" logfile1 logfile2 logfile3


Matthew S. Jarvis
IT Manager
Bike Friday - "Performance that Packs."
www.bikefriday.com
541/687-0487 x140
[EMAIL PROTECTED]
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to