Re: how to convert pf-table into csv
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 ___ freebsd-pf@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-pf To unsubscribe, send any mail to "freebsd-pf-unsubscr...@freebsd.org"
RE: how to convert pf-table into csv
If i use awk, could you give a code an example ? For instance; 10.10.240.77 Cleared: Thu Sep 22 13:22:50 2016 In/Block:[ Packets: 0 Bytes: 0 ] In/Pass: [ Packets: 68000 Bytes: 9899430 ] Out/Block: [ Packets: 0 Bytes: 0 ] Out/Pass:[ Packets: 54731 Bytes: 72930039 ] i want to convert this as below 10.10.240.77,In/Pass: Bytes: 9899430, Out/Pass: Bytes: 72930039 -Original Message- From: Miroslav Lachman [mailto:000.f...@quip.cz] Sent: Thursday, September 22, 2016 12:32 PM To: Yavuz Maşlak ; freebsd-pf@freebsd.org Subject: Re: how to convert pf-table into csv 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 ___ freebsd-pf@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-pf To unsubscribe, send any mail to "freebsd-pf-unsubscr...@freebsd.org"
Re: how to convert pf-table into csv
http://www.grymoire.com/Unix/Awk.html You can lead a horse to water You can lead a horse to water (but you can't make him/it drink). On Thu, Sep 22, 2016 at 5:42 AM, Yavuz Maşlak wrote: > If i use awk, could you give a code an example ? > > For instance; >10.10.240.77 > Cleared: Thu Sep 22 13:22:50 2016 > In/Block:[ Packets: 0 Bytes: 0 > ] > In/Pass: [ Packets: 68000 Bytes: 9899430 > ] > Out/Block: [ Packets: 0 Bytes: 0 > ] > Out/Pass:[ Packets: 54731 Bytes: 72930039 > ] > > > > i want to convert this as below > 10.10.240.77,In/Pass: Bytes: 9899430, Out/Pass: Bytes: 72930039 > > > -Original Message- > From: Miroslav Lachman [mailto:000.f...@quip.cz] > Sent: Thursday, September 22, 2016 12:32 PM > To: Yavuz Maşlak ; freebsd-pf@freebsd.org > Subject: Re: how to convert pf-table into csv > > 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 > > ___ > freebsd-pf@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-pf > To unsubscribe, send any mail to "freebsd-pf-unsubscr...@freebsd.org" > -- Rob Fraser r...@logicalhosting.ca www.logicalhosting.ca ___ freebsd-pf@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-pf To unsubscribe, send any mail to "freebsd-pf-unsubscr...@freebsd.org"