From owner-freebsd-pf@freebsd.org Thu Sep 22 11:51:55 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 ED573BE5B34 for ; Thu, 22 Sep 2016 11:51:55 +0000 (UTC) (envelope-from yavuz.maslak@netiletisim.net) Received: from mail.netiletisim.net (mail.netiletisim.net [213.238.128.137]) (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 A9F01F24 for ; Thu, 22 Sep 2016 11:51:55 +0000 (UTC) (envelope-from yavuz.maslak@netiletisim.net) Received: from localhost (localhost [127.0.0.1]) by mail.netiletisim.net (Postfix) with ESMTP id 8BAB012486C; Thu, 22 Sep 2016 14:43:25 +0300 (EEST) Received: from mail.netiletisim.net ([127.0.0.1]) by localhost (mail.netiletisim.net [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id h4_7AkdZMKIu; Thu, 22 Sep 2016 14:43:25 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by mail.netiletisim.net (Postfix) with ESMTP id 3ED4412486D; Thu, 22 Sep 2016 14:43:25 +0300 (EEST) X-Virus-Scanned: amavisd-new at netiletisim.net Received: from mail.netiletisim.net ([127.0.0.1]) by localhost (mail.netiletisim.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KIuDr2qUvHDa; Thu, 22 Sep 2016 14:43:25 +0300 (EEST) Received: from DESKTOPNUENGRP (unknown [10.11.2.135]) by mail.netiletisim.net (Postfix) with ESMTPSA id 2D95912486C; Thu, 22 Sep 2016 14:43:25 +0300 (EEST) From: =?iso-8859-9?Q?Yavuz_Ma=FElak?= To: "'Miroslav Lachman'" <000.fbsd@quip.cz>, References: <00bf01d20ade$5bc68500$13538f00$@netiletisim.net> <57E3A52B.3020505@quip.cz> In-Reply-To: <57E3A52B.3020505@quip.cz> Subject: RE: how to convert pf-table into csv Date: Thu, 22 Sep 2016 14:42:14 +0300 Message-ID: <01d601d214c6$5ce99de0$16bcd9a0$@netiletisim.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-9" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQJ0B+KIIkq0Z42slN9v97DWBqks5gKjie40nyxdGdA= Content-Language: tr 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 11:51:56 -0000 If i use awk, could you give a code an example ? For instance; =20 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.fbsd@quip.cz]=20 Sent: Thursday, September 22, 2016 12:32 PM To: Yavuz Ma=FElak ; = freebsd-pf@freebsd.org Subject: Re: how to convert pf-table into csv Yavuz Ma=FElak wrote on 09/09/2016 23:08: > =DD 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 > ] > > > > > > =DD 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