#!/usr/bin/perl my $sheet; my $count = -1; while( ) { chomp; $count++; # skip header next unless $count; my $row; @$row = split( /,/, $_ ); push @$sheet, $row; } foreach my $row ( sort { $a->[1] <=> $b->[1] } @$sheet ) { print join( ',', @$row ), "\n"; #### import csv field = 1 data = [] with open('input.csv') as csvfile: readCSV = csv.reader(csvfile, delimiter=',') for row in readCSV: data.append(row) def getKey(item): return item[field] sorted = sorted(data, key=getKey) f = open('output.csv','w') for i in sorted: s = ",".join(i) f.write(s + '\n') f.write(s + '\n') #### 1,Beginning C,Beginning C1 2,Beginning C++,Beginning C++1 3,Python Intro,Python Intro1 4,Acme cook book,Acme cook book1 5,Jumping Jack Flash,Jumping Jack Flash1 6,Zebra,Zebra1 7,Ace hardware,Ace hardware1 8,Baker's dozon,Baker's dozon1 9,Jumbo frames,Jumbo frames1 10,Attack show,Attack show1 11,car 54 where are you,car 54 where are you1 12,navy blue,navy blue1 13,navy gold,navy gold1