read .csv file

Need UNIX script read below .csv file and print the line only records where type = TRN.

Srno,Type,InputFileName,NewColumnData
1,TRN,File1.dat,11
2,TRN,File2.dat,12
3,TRN,File3.dat,13
4,REF,File4.dat,
5,REF,File5.dat,

regards,
santosh

awk -F, '$2=="TRN"' file.csv
$ ruby -ne 'print if $_["TRN"]' file

Here is the ksh script code,

while read line
do
Type=`echo $file | cut -d "," -f 2`
if [ $Type == "TRN" ]; then
 echo $line
done < $input_file
grep TRN infile.csv