From owner-freebsd-pf@freebsd.org Thu Sep 22 09:32:38 2016 Return-Path: Delivered-To: freebsd-pf@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AADDBE3B38 for ; Thu, 22 Sep 2016 09:32:38 +0000 (UTC) (envelope-from 000.fbsd@quip.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C92F3E5 for ; Thu, 22 Sep 2016 09:32:37 +0000 (UTC) (envelope-from 000.fbsd@quip.cz) Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id A94B72847D; Thu, 22 Sep 2016 11:32:28 +0200 (CEST) Received: from illbsd.quip.test (ip-86-49-16-209.net.upcbroadband.cz [86.49.16.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id D74C428590; Thu, 22 Sep 2016 11:32:27 +0200 (CEST) Subject: Re: how to convert pf-table into csv To: =?UTF-8?Q?Yavuz_Ma=c5=9flak?= , freebsd-pf@freebsd.org References: <00bf01d20ade$5bc68500$13538f00$@netiletisim.net> From: Miroslav Lachman <000.fbsd@quip.cz> Message-ID: <57E3A52B.3020505@quip.cz> Date: Thu, 22 Sep 2016 11:32:27 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:42.0) Gecko/20100101 Firefox/42.0 SeaMonkey/2.39 MIME-Version: 1.0 In-Reply-To: <00bf01d20ade$5bc68500$13538f00$@netiletisim.net> Content-Type: text/plain; charset=windows-1254; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2016 09:32:38 -0000 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