Re: Scripting help please....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



From: John Doe <jdmls@xxxxxxxxx>
> A quick and dirty example (only prints the extra duplicate lines; not the 
> original duplicate):
> awk -F: ' { v[$3]=v[$3]+1; if (v[$3]>1) print $0; } ' datafile

Here's the version will the 1st duplicate included:
awk -F: ' { v[$3]=v[$3]+1; if (v[$3] == 1) { f[$3]=$0; } else { if (v[$3] == 2) print f[$3]; print $0; } } ' datafile


      
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux