hunter13605
Technical User
Is there a command that would automatically alphabatize an array of data? I have written one in c++ but it is klunky and very unefficient.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Is there a command that would automatically alphabatize an array of data?
open(FH,'file.txt');
my @unsorted_array = <FH>;
close(FH);
my @sorted_array = sort {lc($a) cmp lc ($b)} @unsorted_array;
print "$_" for @sorted_array;
KevinADC said:Post a few sample lines of the data you want sorted.
open (FH,'users.txt') or die "$!";
my @sorted = map {$_->[0]}
sort {$a->[3] cmp $b->[3]}
map {[$_,split(/,/)]} <FH>;
close(FH);
print for @sorted;
my $in_rec = 'kevin, KEVIN,test,xxxxxxxx,endline';
split( ',', $inrec )
my $target = ( split( ',', $inrec ) )[2];
my $current= ( split( ',' ) )[2];
print TMP $_ while(<IN>);