Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Sep 2016 11:32:27 +0200
From:      Miroslav Lachman <000.fbsd@quip.cz>
To:        =?UTF-8?Q?Yavuz_Ma=c5=9flak?= <yavuz.maslak@netiletisim.net>, freebsd-pf@freebsd.org
Subject:   Re: how to convert pf-table into csv
Message-ID:  <57E3A52B.3020505@quip.cz>
In-Reply-To: <00bf01d20ade$5bc68500$13538f00$@netiletisim.net>
References:  <00bf01d20ade$5bc68500$13538f00$@netiletisim.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Yavuz Maşlak wrote on 09/09/2016 23:08:
> İ have a dynamic pf-table  as below;
>
>
>
>
>
> 10.10.231.230
>
>          Cleared:     Fri Sep  9 22:55:53 2016
>
>          In/Block:    [ Packets: 0                  Bytes: 0
> ]
>
>          In/Pass:     [ Packets: 33455              Bytes: 2796398
> ]
>
>          Out/Block:   [ Packets: 0                  Bytes: 0
> ]
>
>          Out/Pass:    [ Packets: 3068               Bytes: 4350822
> ]
>
>     10.10.231.234
>
>          Cleared:     Fri Sep  9 23:33:18 2016
>
>          In/Block:    [ Packets: 0                  Bytes: 0
> ]
>
>          In/Pass:     [ Packets: 26585              Bytes: 2262193
> ]
>
>          Out/Block:   [ Packets: 0                  Bytes: 0
> ]
>
>          Out/Pass:    [ Packets: 11709              Bytes: 16738469
> ]
>
>
>
>
>
> İ want to convert it to csv format  something like that ;
>
>
>
> Let it begin an ip address and go on its statistics ;
>
> 10.10.231.234, Cleared:     Fri Sep  9 23:33:18 2016, In/Pass:     [
> Packets: 26585              Bytes: 2262193
>
>
>
> How can i do that ?

You need to write some parser of this output in scripting language you 
are familiar with. You can use Perl, Python, Ruby, PHP etc. If you need 
to write it with base utils only you can use awk.

Miroslav Lachman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?57E3A52B.3020505>