Need one more help UNIX script!

October 28, 2011 at 08:31:50
Specs: Windows Vista
Thanks nails for the previous help on this and it worked like a charm. I need one more thing if you guys can help me out..
My file ..

ID|FNAME|LNAME|EMAIL|COUNTRY
1|SMITH|JOHN|SMITH@UA.COM|US
2|SMITH|JOHN|SMITH@US.COM|US

Similar like the one I asked previously , I need to check for First name + Last name duplicates in a file and print if they are < 10. Meaning, I need to check the complete file for duplicates with first name + Last name and the total number of duplicates is more than 10 then remove the entire records if not keep the records. Any help would be appreciated.


See More: Need one more help UNIX script!

Report •

#1
October 28, 2011 at 10:55:17
The answer is the same as the other script only last name and first name have to be a key.

As I am traveling today, you will have to test this yourself.


#!/bin/ksh

# UNTESTED!
rm -f mynewdata3.txt
awk ' BEGIN { FS="|";
while ( getline < "mydata3.txt" > 0 )
myname[$3$2]=myname[$3$2]+1
}
{

if($3$2 in myname)
if(myname[$3$2] < 10)
print $0 >> "mynewdata3.txt"

} ' mydata3.txt



Report •

#2
November 2, 2011 at 10:15:16
Thanks ..works like a charm

Report •
Related Solutions


Ask Question