How to split CSV file by Column values into multiple files on a Mac? awk?
Your approach would mostly work, although you'd end up with column A in the output file, which may not be what you want.  Here's another approach that doesn't put column A in the output file:

awk -F, '{outfile=($1 ".csv") ; print substr($0,index($0,$2)) &gt;&gt;outfile ; close(outfile)}' &lt;name_of_input_file


You said "CSV", so use a comma as the field separator.