That or right below the Sort alphabetically check box you already have on the select columns. Sort custom. In looking closer at the notepad-plus-plus example the regex is used to change the format so the normal text sort can sort the entries. Then it is uses again to change the format back. That said its a multistep process so I don't think It can be achieved with just 1 regular expression statement. Just thinking on the fly here, you mentioned the user entering text instead of selecting a column.. if code isn't added to HS to sort IP addresses perhaps in the field we could refer to an external program. Thinking something like this:
- HS could create a temp file with the contents of the column in question and call the external program with the file name as a parameter.
- External program does sort and writes results back to file then exits with success or failure.
- HS reads the temp file and displays the sorted column.
The rows could be passed as parameters but the number of rows would be limited, thus I'd think a file would provide a much greater number of rows to be sorted. Then the user could use their favorite language to open and sort. For example the perl script below does the trick ( I pieced this together from posts by Jean and Sean on stackoverflow )
#!/usr/bin/perl
use strict;
use warnings;
my $ip = $ARGV[0];
open my $handle, '<', $ip;
chomp(my @lines = <$handle>);
close $handle;
my @sorted =
map substr($_, 4),
sort
map pack('C4a*', split(/\./), $_),
@lines;
foreach (@sorted)
{
print($_ . "\n");
}
Now my data is in the netrange format so I'd have to change the script to split and just use the 1st part, but still, I'm sure you get the idea. Id think creating that temp file in a .csv format would work where first column is the data and 2nd column is the row number. The above Perl script of course doesn't deal with that but its an easy change to have it write back to a csv format.
Well enough of my rambling for now, time for me head to work :-) and Thanks again.