I have some data in a file in the form of csv of the form:
ID,DATE,EARNING
1,12 May 2018,5
1,13 May 2018,15
2,12 May 2018,25
I want to split this into multiple files such that file_1_May_report contains:
ID,DATE,EARNING
1,12 May 2018,5
1,13 May 2018,15
and another file file_2_May_report that contains:
ID,DATE,EARNING
2,12 May 2018,25
I have tried :
awk -F, '{print >> $1}' input.csv
However I only get one file 1 with only one record, that is the last record in the input file. How do I get it to split into multiple files based on ID?