Author: dbecker
Subject: Unique sort situation....
Posted: Wed Apr 27, 2016 8:53 pm (GMT 5.5)
Here is what I need to do. First 4 bytes in file are M2## followed by a 13 byte numeric.
Example..
I need to be able to sort these records by the 13 byte numeric starting in column 5 and then sort by the first 4 bytes. Here is the kicker....I need the first 4 bytes sorted in order so that M201, then M202, then M203..etc etc.....BUT I need M204 to always be last and not after M203. I know one could modify the file and change all M204 in pos 1 - 4 to M299 and then sort and then change back to M204. I was hoping there would be a way to do this in a single shot using syncsort.....but I'm not coming up with anything in my search and reading.
Thanks.
Subject: Unique sort situation....
Posted: Wed Apr 27, 2016 8:53 pm (GMT 5.5)
Here is what I need to do. First 4 bytes in file are M2## followed by a 13 byte numeric.
Example..
Code: |
M2031111111111111 M2041111111111111 M2091111111111111 M2091111111111111 M2091111111111111 M2101111111111111 M2131111111111111 M2191111111111111 M2191111111111111 M2191111111111111 M2191111111111111 M2191111111111111 M2191111111111111 M2191111111111111 M2191111111111111 M2191111111111111 M2191111111111111 M2191111111111111 M2191111111111111 M2032222222222222 M2042222222222222 M2042222222222222 M2132222222222222 M2192222222222222 M2192222222222222 M2192222222222222 M2192222222222222 M2192222222222222 M2192222222222222 M2192222222222222 M2192222222222222 M2192222222222222 M2192222222222222 |
I need to be able to sort these records by the 13 byte numeric starting in column 5 and then sort by the first 4 bytes. Here is the kicker....I need the first 4 bytes sorted in order so that M201, then M202, then M203..etc etc.....BUT I need M204 to always be last and not after M203. I know one could modify the file and change all M204 in pos 1 - 4 to M299 and then sort and then change back to M204. I was hoping there would be a way to do this in a single shot using syncsort.....but I'm not coming up with anything in my search and reading.
Thanks.