Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi skuthe, Well, I thought about

Status
Not open for further replies.

Grant

Programmer
Apr 10, 1999
105
CA
Hi skuthe,

Well, I thought about it. It seems to me the following will do what you want (and it's simpler):


Command line syntax:
% my.awk col_1 col_2 ... col_n file


BEGIN{

# Get list of columns from command line.
# Also get MaxCols.

}

#main
{
# Use list of columns to build SUBSCRIPT made
# up of concatenated list of values from those
# columns.

array[SUBSCRIPT]+=1;

# Use array[SUBSCRIPT] to test each record to see
# if it was a duplicate.
(if array[SUBSCRIPT] > 1)
{
print $0 > "dupefile.txt";
}
else
{
print $0 > "otherfile.txt";
}
}



Grant.
 
Whoops,

This was supposed to be an answer to a previous thread. Please disregard.

Grant.
 
Grant,
Nope, it does not work.
It copies all the records of the input file into the dup file whithout writing anything to the Non-dup file.
(i.e It replicates the input file ).

Waiting for your response,
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top