Split a file based on the first column of that file

This is useful, but unfortunately uses awk. Note that you should remove the header from the file (if this exists).

awk '{ st = index($0,","); print $0 > (substr($0,st+1) ".txt") }' snps_matrix_noheader.csv

The substr and index are required as the length of the first field may be unknown or not constant through all rows. This will save each partition in a file named as the entry in the first column.