From owner-freebsd-pf@freebsd.org Thu Sep 22 12:09: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 DEEFABE39B8 for ; Thu, 22 Sep 2016 12:09:38 +0000 (UTC) (envelope-from rob@logicalhosting.ca) Received: from mail-oi0-x230.google.com (mail-oi0-x230.google.com [IPv6:2607:f8b0:4003:c06::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A66F21BB for ; Thu, 22 Sep 2016 12:09:38 +0000 (UTC) (envelope-from rob@logicalhosting.ca) Received: by mail-oi0-x230.google.com with SMTP id r126so94691073oib.0 for ; Thu, 22 Sep 2016 05:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=logicalhosting.ca; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AXJVKX5fjKxE6Qe+4vSiq4Lwl1kIvPsjCyj+AgEwY5o=; b=bgIe0wtJsksD5El1zs3Axds+CR7B38q9WrWL6NjZhsj3FfiIF7eZLQMLxGvWQ0OcCV sAKjCfKj/gXiRVCj6rxQlJav1OPvjxY1THR/zZ/SA/FUUQhDydc9/bX76AcgHrOpL+gj /j6flqGQwP7u58WygQr6fZj7utO8zzeIw7Xf8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AXJVKX5fjKxE6Qe+4vSiq4Lwl1kIvPsjCyj+AgEwY5o=; b=PdrzR0oqpMZ83ypKVqUQ9GNdNBKcTr9v7zSY6uIhukaZ5YdoDtuNddvmu4BnajbJPf 56z9Wiys6lHs8TItu5OgAzEF0p1XkB6/7QGwYnlI+EmfAldZkXv0FaVBxR7YdAAzVGTP rhHohXRqHIXhQH+KfwPWFBpwQr2NegxVtp5DqdvP82ZwfCqQxw6A6wI6hDqepSq3wBnJ qSphRvgw+2uhgp9FDZPu+KgxQV2nZd7zJaHTzEJwKA82ARo0v2PDSEGBK97lICDPV8ze 5gqKI8tLB7uHHlUzSgClkmFuv4LcAr3KVQGlx5HEVGor1QoclbM/kkHiE5lhfc2y72Sl 0eWQ== X-Gm-Message-State: AE9vXwO5///qxMsq53rmQpbetvARKZsLIa92GDAW4PsScOFEIIu936V2rNaFNP5XIZ+Wxp4/VhCyzg+s/QYzVQ== X-Received: by 10.202.245.206 with SMTP id t197mr1791025oih.162.1474546177984; Thu, 22 Sep 2016 05:09:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.104.36 with HTTP; Thu, 22 Sep 2016 05:09:37 -0700 (PDT) In-Reply-To: <01d601d214c6$5ce99de0$16bcd9a0$@netiletisim.net> References: <00bf01d20ade$5bc68500$13538f00$@netiletisim.net> <57E3A52B.3020505@quip.cz> <01d601d214c6$5ce99de0$16bcd9a0$@netiletisim.net> From: Rob Fraser Date: Thu, 22 Sep 2016 06:09:37 -0600 Message-ID: Subject: Re: how to convert pf-table into csv To: =?UTF-8?Q?Yavuz_Ma=C5=9Flak?= Cc: Miroslav Lachman <000.fbsd@quip.cz>, freebsd-pf@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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 12:09:39 -0000 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=C5=9Flak 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.fbsd@quip.cz] > Sent: Thursday, September 22, 2016 12:32 PM > To: Yavuz Ma=C5=9Flak ; freebsd-pf@freebsd.= org > Subject: Re: how to convert pf-table into csv > > Yavuz Ma=C5=9Flak wrote on 09/09/2016 23:08: > > =C4=B0 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 > > ] > > > > > > > > > > > > =C4=B0 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 ar= e > 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-unsubscribe@freebsd.org" > --=20 Rob Fraser rob@logicalhosting.ca www.logicalhosting.ca