shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [shell-script] pegar quantidade de ips diferentes...


From: Tiago Peczenyj
Subject: Re: [shell-script] pegar quantidade de ips diferentes...
Date: Tue, 20 Oct 2009 16:26:21 -0200

Nesses casos vc poderia colocar uma boa parte do seu arquivo num pastebin da
vida ;-)

Se uma linha desse arquivo é assim:
RC=192.168.113.28 =74.86.245.121 LEN=60 TOS=0x00 PREC=0x00 TTL=63

Bastaria fazer algo como:

grep SRC= arquivo | cut -f2 -d= | sort | uniq -c

      8 192.168.113.12
      8 192.168.113.14
      9 192.168.113.28

Agora se vc quer filtrar por faixa de ip basta alterar o grep.


2009/10/20 Marcelo <address@hidden>

>
>
> Olá,
>
> Tenho o seguinte conteudo de um arquivo.txt gerado por um outro script:
>
> Oct 20 13:00:09 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.28 =74.86.245.121 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=25909 PROTO=ICMP TYPE=8 CODE=0 ID=512 SEQ=34816
> Oct 20 13:00:10 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.12 =74.54.138.210 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=4072 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=451
> Oct 20 13:00:37 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.14 =75.125.189.114 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=32611 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=451
> Oct 20 13:00:49 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.28 =75.126.120.205 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=26176 PROTO=ICMP TYPE=8 CODE=0 ID=512 SEQ=35072
> Oct 20 13:00:50 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.12 =74.54.138.226 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=4077 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=452
> Oct 20 13:01:17 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.14 =74.55.73.254 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=32612 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=452
> Oct 20 13:01:29 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.28 =75.126.120.201 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=26323 PROTO=ICMP TYPE=8 CODE=0 ID=512 SEQ=35328
> Oct 20 13:01:30 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.12 =74.54.138.162 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=4086 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=453
> Oct 20 13:01:57 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.14 =74.55.74.6 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=32613
> PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=453
> Oct 20 13:02:09 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.28 =75.126.120.202 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=26354 PROTO=ICMP TYPE=8 CODE=0 ID=512 SEQ=35584
> Oct 20 13:02:10 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.12 =74.54.138.194 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=4095 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=454
> Oct 20 13:02:37 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.14 =74.55.70.142 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=32616 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=454
> Oct 20 13:02:49 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.28 =75.126.120.203 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=26386 PROTO=ICMP TYPE=8 CODE=0 ID=512 SEQ=35840
> Oct 20 13:02:50 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.12 =74.86.232.45 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=4099 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=455
> Oct 20 13:03:17 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.14 =75.125.191.2 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=32617 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=455
> Oct 20 13:03:29 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.28 =67.228.112.200 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=26387 PROTO=ICMP TYPE=8 CODE=0 ID=512 SEQ=36096
> Oct 20 13:03:31 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.12 =74.86.232.46 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=4109 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=456
> Oct 20 13:03:57 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.14 =75.125.186.82 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=32619 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=456
> Oct 20 13:04:09 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.28 =67.228.112.197 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=26388 PROTO=ICMP TYPE=8 CODE=0 ID=512 SEQ=36352
> Oct 20 13:04:11 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.12 =74.86.245.115 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=4117 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=457
> Oct 20 13:04:37 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.14 =75.125.188.242 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=32639 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=457
> Oct 20 13:04:49 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.28 =74.86.245.122 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=26390 PROTO=ICMP TYPE=8 CODE=0 ID=512 SEQ=36608
> Oct 20 13:04:52 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.12 =70.86.84.98 LEN=60 TOS=0x00 PREC=0x00 TTL=63 ID=4123
> PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=458
> Oct 20 13:05:17 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.14 =74.55.74.138 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=32640 PROTO=ICMP TYPE=8 CODE=0 ID=1 SEQ=458
> Oct 20 13:05:29 server kernel: PING:-FORA-DOMINIO-- IN=eth1 OUT=eth0
> SRC=192.168.113.28 =75.126.120.200 LEN=60 TOS=0x00 PREC=0x00 TTL=63
> ID=34269 PROTO=ICMP TYPE=8 CODE=0 ID=512 SEQ=36864
>
> E nao imagino "por enquanto" como pegar por exemplo quantas entradas
> existem para cada ip-interno:(de forma automática) estou no modo
> "luzitano" :P
>
> fgrep 192.168.113.12 arquivo.txt|wc -l
> 8
> fgrep 192.168.113.14 arquivo.txt|wc -l
> 8
> fgrep 192.168.113.28 arquivo.txt|wc -l
> 9
>
> dicas?
>
> Obrigado.
>
> ----------------------------------------------------------
> Esta mensagem pode conter informacao confidencial.
> Se voce nao for o destinatario ou a pessoa autorizada a receber
> esta mensagem, nao podera usar, copiar ou divulgar as informacoes nela
> contidas ou tomar qualquer acao baseada nessas informacoes. Se
> voce recebeu esta mensagem por engano, favor avisar imediatamente o
> remetente, respondendo o e-mail e, em seguida, apague-o.
> Agradecemos sua cooperacao.
>
> This message may contain confidential information.
> If you are not the addressee or authorized person to receive it for the
> addressee, you must not use, copy, disclose or take any action based on
> this message or any information herein. If you have received this message
> in error, please advise the sender immediately by replying this e-mail
> message and delete it.
> Thanks in advance for your cooperation.
> ----------------------------------------------------------
> Faculdade de Medicina USP
> ----------------------------------------------------------
>
>  
>



-- 
Tiago B. Peczenyj
Linux User #405772

http://pacman.blog.br


[As partes desta mensagem que não continham texto foram removidas]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]