You could do this in ASPECT using a standard sort routine (bubble, quick, etc.) on the first part of the string, but I'm rusty on my sorting skills so I don't recall which would be best in this situation. It would likely be slow since you couldn't hold all 100,000 numbers in one array in an ASPECT script at the same time, which may necessitate using a couple additional temporary files to hold the interim results.
It may be easier to import the file into a word processor or database package and sort it there. In Microsoft Word, you can go to the Table menu, choose Sort, and then sort by paragraphs, assuming each entry is read as a separte line.
In Access, you can import a text file, assign a primary key, and the data will be automatically sorted.
If either of these solutions sounds workable for you, I can provide more instructions.
I am not entirely sure but I don't think there would be any problem in treating these numbers as floats which should give a full 14 digits of (decimal) range.
[note: as per aspect help it gives 15 decimal places but is limited to some value, so to ensure all digits can be all values, subtract one digit and you are assured of full range on to that many digits.]
Although normally used to allow for decimal numbers floats can be used for numbers without decimal portions gaining the extra digit capability.
If I am wrong and float causes problems:
To sort a number bigger than aspect handles with its built in data types you could split the text number into two (or more) portions of 9 digits or less.
[again note aspect integer and long both give 10 digits of range but up to a limited value so by subtracting 1 digit you get full range.]
[also note they appear to give the same ranges, so long provides no value that I can see]
After splitting the text number into parts then the data can be sorted (including the split numbers) starting with the first portion and continuing with the next portions.
A little programming but if you need it maybe worth it.
Of course exporting to excel sorting there and bringing it back could work but that presents it's own set of difficulties.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.