From owner-freebsd-questions@FreeBSD.ORG Thu Nov 6 18:07:04 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5657FA28 for ; Thu, 6 Nov 2014 18:07:04 +0000 (UTC) Received: from mx1.uso.edu (smtp.uso.edu [131.187.90.204]) by mx1.freebsd.org (Postfix) with ESMTP id 15F931CA for ; Thu, 6 Nov 2014 18:07:03 +0000 (UTC) Received: from unknown (HELO USOAPP09V04P.si.lan) ([131.187.110.68]) by mx1.uso.edu with ESMTP; 06 Nov 2014 13:05:55 -0500 Received: from USOAPP08V04P.si.lan ([169.254.1.90]) by USOAPP09V04P.si.lan ([131.187.110.68]) with mapi id 14.01.0438.000; Thu, 6 Nov 2014 13:05:55 -0500 From: Nick Wolff To: Janos Dohanics , FreeBSD Questions Subject: Re: uniq(1) on last field Thread-Topic: uniq(1) on last field Thread-Index: AQHP+dxdz9NQRmHCnkCr+HDLFWlXjpxT5OKA Date: Thu, 6 Nov 2014 18:05:54 +0000 Message-ID: References: <20141106110319.eb34eaa069a4881824072010@3dresearch.com> In-Reply-To: <20141106110319.eb34eaa069a4881824072010@3dresearch.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.4.5.141003 x-originating-ip: [131.187.109.9] Content-Type: text/plain; charset="Windows-1252" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Nov 2014 18:07:04 -0000 Janos, What do you want the final output to look like I have some ideas but am not sure exactly what your looking for. If you just want a list of file names then: "cat log | rev | cut -d=B9/=8C -f1 |rev |uniq=B2 Should give you the output you looking for. Basically you can just flip the whole string using rev(1) so the last field is now the first one. If that=B9s not what your looking for let me know a basically write scripts like this for a living so it=B9s a good thing that I enjoy the puzzles they make. =20 Nick Wolff Backbone Routing Engineer Hostmaster OARnet email: nwolff@oar.net =20 On 11/6/14, 11:03 AM, "Janos Dohanics" wrote: >Hello List, > >Would you please help with a shell scripting problem. I have a samba >audit log file which after some parsing has entries like this: > >Nov 5 10:26:29 testuser 10.10.10.72 pluto pwrite ok COMMON/Solidworks >Parts & Assemblies/Filter Elements/~$Element 2-3187.SLDPRT >Nov 5 12:50:54 testuser 10.10.10.72 pluto pwrite ok COMMON/Solidworks >Parts & Assemblies/Filter Elements/~$Element 2-3187.SLDPRT >Nov 5 14:05:52 testuser 10.10.10.72 pluto pwrite ok COMMON/Solidworks >Parts & Assemblies/Filter Elements/~$Element 2-3187.SLDPRT >Nov 5 17:30:06 testuser 10.10.10.72 pluto pwrite ok COMMON/Solidworks >Parts & Assemblies/Filter Elements/~$Element 2-3187.SLDPRT >Nov 5 09:32:48 testuser 10.10.10.72 pluto pwrite ok COMMON/Solidworks >Parts & Assemblies/Gaskets/Flexitallic/10in/~$10in ANSI 600 >Flexitallic.SLDPRT >Nov 5 09:32:48 testuser 10.10.10.72 pluto pwrite ok COMMON/Solidworks >Parts & Assemblies/Gaskets/Flexitallic/20in/~$20in ANSI 600 >Flexitallic.SLDPRT >Nov 5 09:32:32 testuser 10.10.10.72 pluto pwrite ok COMMON/Solidworks >Parts & Assemblies/Lifting Lugs/~$54in Tower Lifting Lug.SLDPRT >Nov 5 10:31:29 testuser 10.10.10.72 pluto pwrite ok COMMON/Solidworks >Parts & Assemblies/CDE - Beck/Tube Baffle Coalescer Model/~$40in OD >Shell.SLDPRT >Nov 5 10:32:20 testuser 10.10.10.72 pluto pwrite ok COMMON/Solidworks >Parts & Assemblies/CDE - Beck/Tube Baffle Coalescer Model/~$40in OD >Shell.SLDPRT >Nov 5 12:54:43 testuser 10.10.10.72 pluto pwrite ok COMMON/Solidworks >Parts & Assemblies/CDE - Beck/Tube Baffle Coalescer Model/~$40in OD >Shell.SLDPRT >Nov 5 15:07:10 testuser 10.10.10.72 pluto pwrite ok COMMON/Solidworks >Parts & Assemblies/CDE - Beck/Tube Baffle Coalescer Model/~$40in OD >Shell.SLDPRT > >I would like to use uniq(1) on the file name, which is of course the >last field if / is used as field separator. > >How can I tell uniq(1) the "last field" if I have variable number of >fields? > >--=20 >Janos Dohanics >_______________________________________________ >freebsd-questions@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-questions >To unsubscribe, send any mail to >"freebsd-questions-unsubscribe@freebsd.org"