rendered paste body#!/usr/local/bin/perl
my $sort_col = 4;
my @output =
sort {
(split ',', $a)[$sort_col - 1] cmp
(split ',', $b)[$sort_col - 1]
} <DATA>;
print for @output;
__DATA__
0,115608,2,3237821,0,0
0,115612,1,3237825,0,0
1,115612,0,3237825,0,0
0,115612,1,3237825,0,0
0,115616,2,3237829,0,0
0,115616,2,3237829,0,0
0,115616,2,3237829,0,0
OUT
0,115608,2,3237821,0,0
0,115612,1,3237825,0,0
1,115612,0,3237825,0,0
0,115612,1,3237825,0,0
0,115616,2,3237829,0,0
0,115616,2,3237829,0,0
0,115616,2,3237829,0,0
***************************************************
=================
#!/usr/local/bin/perl
my $sort_col = 4;
my @output =
sort {
(split ',', $a)[$sort_col - 1] cmp
(split ',', $b)[$sort_col - 1]
} <DATA>;
print for @output;
__DATA__
0,115608,2,3237821,0,0
0,115612,2,3237825,0,0
0,115612,2,3237825,0,0
0,115612,2,3237825,0,0
0,115616,2,3237829,0,0
0,115616,2,3237829,0,0
0,115616,2,3237829,0,0
0,115620,2,3237833,0,0
0,115620,2,3237833,0,0
0,115620,2,3237833,0,0
0,115624,2,3237837,0,0
0,115624,2,3237837,0,0
0,115624,2,3237837,0,0
0,115628,2,3237841,0,0
0,115628,2,3237841,0,0
0,115628,2,3237841,0,0
0,115632,2,3237845,0,0
0,115632,2,3237845,0,0
0,115632,2,3237845,0,0
0,115636,2,3237849,0,0
0,115636,2,3237849,0,0
0,115636,2,3237849,0,0
0,115640,2,3237853,0,0
0,115640,2,3237853,0,0
0,115640,2,3237853,0,0
0,115644,2,3237857,0,0
0,115644,2,3237857,0,0