I have strings such as:
import a.b.c.d.f.Class1
import a.b.g.d.f.Class2
import a.b.h.d.f.Class3
import z.y.x.d.f.Class4
import z.y.x.d.f.Class5
import z.y.x.d.f.Class6
I want to get all unique occurrences of the first part of the String. More specifically up to the third period. So I do:
grep "import curam" -hr --include \*.java | sort | gawk -F "." '{print $1"."$2"."$3}' | uniq
which gives me:
import a.b.c
import a.b.g
import a.b.h
import z.y.x
However, I'd like to get the full String for the first occurrence when the String up until the third period was unique. So, I want to get:
import a.b.c.d.f.Class1
import a.b.g.d.f.Class2
import a.b.h.d.f.Class3
import z.y.x.d.f.Class4
Any ideas?