dougcranston
Technical User
Ladies and Gentlemen,
I am struggling to find a way to remove duplicate lines from a pipe delimited file utilzing AWK.
I get a file between 2k-5k
The file is Sorted by the REF column.
SAMPLE INPUT FILE
CD|REF|NAME|Month|Year
A12345N|123123|GALLAGH T|09|2007
D2345AN|123123|GALLAGH T|09|2007
D2345AN|345678|FOLLGERS J|09|2007
A12345N|654321|JOHNS A|09|2007
D2345AN|654321|JOHNS A|09|2007
A42345N|078982|VANCLYBURN A|09|2007
The REF Column is the one contains duplicates.
The output would result in a file with only the first record written to an output file.
SAMPLE NEEDED OUTPUT FILE
CD|REF|NAME|Month|Year
A12345N|123123|GALLAGH T|09|2007
D2345AN|345678|FOLLGERS J|09|2007
A12345N|654321|JOHNS A|09|2007
A42345N|078982|VANCLYBURN A|09|2007
I am running on an MS desktop and no access to LINUX or UNIx systems, but do have a commandline version of AWK.
I have tried searching this site and the web and not found a script that either works or that I understand how to adapt to solve this issue.
Any suggestions would be greatly appreciated.
Thanks,
Dougc
I am struggling to find a way to remove duplicate lines from a pipe delimited file utilzing AWK.
I get a file between 2k-5k
The file is Sorted by the REF column.
SAMPLE INPUT FILE
CD|REF|NAME|Month|Year
A12345N|123123|GALLAGH T|09|2007
D2345AN|123123|GALLAGH T|09|2007
D2345AN|345678|FOLLGERS J|09|2007
A12345N|654321|JOHNS A|09|2007
D2345AN|654321|JOHNS A|09|2007
A42345N|078982|VANCLYBURN A|09|2007
The REF Column is the one contains duplicates.
The output would result in a file with only the first record written to an output file.
SAMPLE NEEDED OUTPUT FILE
CD|REF|NAME|Month|Year
A12345N|123123|GALLAGH T|09|2007
D2345AN|345678|FOLLGERS J|09|2007
A12345N|654321|JOHNS A|09|2007
A42345N|078982|VANCLYBURN A|09|2007
I am running on an MS desktop and no access to LINUX or UNIx systems, but do have a commandline version of AWK.
I have tried searching this site and the web and not found a script that either works or that I understand how to adapt to solve this issue.
Any suggestions would be greatly appreciated.
Thanks,
Dougc