[CentOS] Scripting help please....
John Doe
jdmls at yahoo.comThu Oct 29 10:26:08 UTC 2009
- Previous message: [CentOS] Scripting help please....
- Next message: [CentOS] Scripting help please....
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: John Doe <jdmls at yahoo.com> > 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
- Previous message: [CentOS] Scripting help please....
- Next message: [CentOS] Scripting help please....
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the CentOS mailing list