john.tm has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl use strict; use warnings; open (SORT1, "+>C:\\temp\\SORT.CSV") or die "Cannot open file $!\n"; my @sorted = map {$_->[0]} sort { $a->[6] cmp $b->[6] || $a->[2] cmp $b->[2] || $a->[5] cmp $b->[5] || $a->[9] <=> $b->[9]} map {chomp;[$_,split(/,/)]} <SORT1>; foreach(@sorted) { printf SORT1 "$_\n"; } close (SORT1);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sort a csv file then updta the same file
by kennethk (Abbot) on May 28, 2014 at 23:57 UTC | |
by Anonymous Monk on Nov 26, 2015 at 11:35 UTC | |
by kennethk (Abbot) on Nov 27, 2015 at 17:24 UTC | |
|
Re: sort a csv file then update the same file
by Tux (Canon) on May 29, 2014 at 09:36 UTC | |
|
Re: sort a csv file then update the same file
by Laurent_R (Canon) on May 29, 2014 at 09:47 UTC |