IM,BEN01,D,0 IM,BEN02,D,0 IM,BEN03, ,0 IM,BEN04, ,0 IM,BEN05, ,0 IM,BEN06,C,0 IM,BEN07, ,0 IM,BEN08, ,0 IM,BEN09, ,0 IM,BEN10,D,0 #### #!/usr/bin/perl open(MYINPUTFILE, ") { my($line) = $_; chomp($line); @data = split(/,/, $line); if ((@data[2] eq "D")||(@data[2] eq "C")) { printf ("\n type "); print @data[2]." "; print @data[1].".txt "; } else { print @data[1].".txt "; } } close(MYINPUTFILE); #### type D BEN01.txt type D BEN02.txt BEN03.txt BEN04.txt BEN05.txt type C BEN06.txt BEN07.txt BEN08.txt BEN09.txt type D BEN10.txt #### type D BEN01.txt > BEN01.txt type D BEN02.txt BEN03.txt BEN04.txt BEN05.txt >BEN02.txt type C BEN06.txt BEN07.txt BEN08.txt BEN09.txt > BEN06.txt type D BEN10.txt > BEN10.txt #### type D BEN01.txt > BEN01.txt type D BEN02.txt BEN03.txt BEN04.txt BEN05.txt > BEN05.txt type C BEN06.txt BEN07.txt BEN08.txt BEN09.txt >BEN09.txt type D BEN10.txt > BEN10.txt