Created
August 19, 2023 00:27
Revisions
-
timrprobocom created this gist
Aug 19, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ lines = """\ ABCDE12345_001,FGHIJ6789_002,ABCDE12345_001 KLMNO5432_003,KLMNO5432_003,FGHIJ6789_002 PQRST24680_123,UVWXY13579_555,UVWXY13579_555 ZABCD876530_009,ZABCD876530_009,AABBCCDDEE_987 AABBCCDDEE_987,AABBCCDDEE_987,LMNOP98765_999 LMNOP98765_999,ZYXWV54321_777,ZYXWV54321_777""".splitlines() record = [] for row in lines: record += [(word,ordinal) for ordinal,word in enumerate(row.split(','))] record.sort() last = None build = None for word,posn in record: if word != last: if build: print(','.join(build)) build = ['','',''] last = word build[posn] = word print(','.join(build))