The are multiple examples freely available to do exactly that. One of the tools that enables you to do this from the command-line is xlscat as available in the Spreadsheet::Read distribution. That will (also) use Text::CSV_XS to parse your CSV data
$ xlscat --sort=31n,1n,2n file.csv
As your CSV however is not valid CSV (see ,"Max Smart Super, Speciality Hospital "O"", where the double quotes inside the field are not escaped), you might need to roll your own script.
A really quick braindump that works on the snippet you showed is:
use 5.18.2; use warnings; use Data::Peek; use Text::CSV_XS qw( csv ); my $aoa = csv (in => "test.csv", escape => undef, allow_loose_quotes = +> 1); csv (in => [ sort { $a->[30] <=> $b->[30] || $a->[0] <=> $b->[0] || $a->[1] <=> $b->[1] } @$aoa ]);
In reply to Re: Need to sort comma delimited, double quoted file
by Tux
in thread Need to sort comma delimited, double quoted file
by CSharma
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |