harsha.pic
Newbie
Actually today morning i have downloaded a CSV file for a month of my net usage of reliance wireless broadband and i wanted to know what is total usage, morning time usage(6am to 10pm) and night usage separately(10pm to 6am). But i got confused to know it by opening data usage CSV file downloaded from myserevices from reliance website...
So i wrote a perl code to know with that CSV file.....might be useful for others also.....below shared perl code....
and njoy.....##welcome to reliance data usage tool####my $csv_file;print("plese enter give path of relaince CSV file:");chomp( $csv_file = );@mrng_hash = ();@evening_hash = ();open(INFO, $csv_file); # Open the fileforeach $line (){if($line =~ /^([0-9\-]+)\,(\s*[0-9\:]+)\,(.+)\,(\s*[0-9\.]+)$/){#print $2."--->".$4."\n";$time = $2;$bytes = $4;if($time =~ /\s*(\d+)\
\d+)\
\d+)\s*/){if($1>=22){ push(@evening_hash,$bytes);}else{ push(@mrng_hash,$bytes);}}}}close(INFO); # Close the file$eve_total = 0;foreach $temp (@evening_hash) {$eve_total = $eve_total+ $temp;}$mrn_total = 0;foreach $temp (@mrng_hash) {$mrn_total = $mrn_total+ $temp;}print "Morning time usage is--->".$mrn_total."--->".($mrn_total/1000000)." GB\n";print "Evening time usage is--->".$eve_total."--->".($eve_total/1000000)." GB\n";print "Total time usage is--->".($mrn_total+$eve_total)."--->".(($mrn_total+$eve_total)/1000000)." GB\n";