uniq(1) on last field
Alex Stangl
alex at stangl.us
Thu Nov 6 18:43:13 UTC 2014
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
More information about the freebsd-questions
mailing list