|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
find out duplicate records in file?
Dear All,
I have one file which looks like : account1 asswd1account2 asswd2account3 asswd3account1 asswd4account5 asswd5account6 asswd6you can see there're two records for account1. and is there any shell command which can find out : account1 is the duplicate record in file? Thanks. |
| Sponsored Links | ||
|
|
|
#2
|
|||
|
|||
|
Code:
awk -F":" '{_[$1]++}
END{
for (i in _)
print "Duplicated: _[i]
}' filename |
|
#3
|
|||
|
|||
|
i guess there's one missing " in 4th line?
but after appending the " , it still doesn't work... |
|
#4
|
||||
|
||||
|
Quote:
|
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| compare fields in a file with duplicate records | rleal | Shell Programming and Scripting | 1 | 01-29-2009 01:55 AM |
| find duplicate records... again | rleal | Shell Programming and Scripting | 4 | 01-28-2009 05:30 PM |
| How to find Duplicate Records in a text file | G.Aavudai | Shell Programming and Scripting | 1 | 10-17-2008 04:59 AM |
| Duplicate records from oracle to text file. | shilendrajadon | UNIX for Advanced & Expert Users | 1 | 01-10-2008 10:21 AM |
| Remove all instances of duplicate records from the file | vukkusila | Shell Programming and Scripting | 3 | 12-12-2007 06:50 AM |