1

I've got this file:

aaa.bbb.ccc.ddd
aaa.bbb.eee.ccc
ggg.hhh.jjj.kkk
fff.uuu.yyy.ddd
eee.rrr.ddd.bbb
eee.rrr.www.zzz
eee.rrr.sss.nnn
eee.rrr.qqq.kkk

I want to filter it so it displays the whole line only when the first occurrence of the first two columns happens.

The expected output is:

aaa.bbb.ccc.ddd
ggg.hhh.jjj.kkk
fff.uuu.yyy.ddd
eee.rrr.ddd.bbb

So far what I could do was:

cat file |awk -F"." '{print $1"."$2}' |uniq -c

but it only shows the first first two columns and the number of repetitions.

karel
  • 2,030

0 Answers0