Date: Thu, 6 Nov 2014 12:43:06 -0600 From: Alex Stangl <alex@stangl.us> To: freebsd-questions@freebsd.org Subject: Re: uniq(1) on last field Message-ID: <20141106184306.GA14996@scout.stangl.us> In-Reply-To: <20141106110319.eb34eaa069a4881824072010@3dresearch.com> References: <20141106110319.eb34eaa069a4881824072010@3dresearch.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 06, 2014 at 11:03:19AM -0500, Janos Dohanics wrote:
> 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 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.
$ awk -F'/' '{printf "%s%s%s\n", $NF, "/", $0}' yourfile.txt | sort -k '1,1' -u -t'/' | cut -f2- -d'/'
Alex
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141106184306.GA14996>
