I am getting a file with content below
The first three values might be repeating in other lines I want to keep one instance and remove other duplicates
the output should be like below
I am getting a file with content below
The first three values might be repeating in other lines I want to keep one instance and remove other duplicates
the output should be like below
I would try
awk '!a[$1 $2 $3]++ { print ;}' file
where
!a[$1 $2 $3]++ will evaluate to true first time thoses values are found.see How does awk '!a[$0]++' work? for more details.
a[$1,$2,$3] (with commas) as that inserts the value of SUBSEP between the values that makes up the key instead of just concatenating. A set of 1, 23, 4 would otherwise be indistinguishable from the set 12, 3, 4. Also, { print; } is not actually needed.
– Kusalananda
Sep 02 '20 at 12:27