need help in splitting the file
hi
i have file with the format as below. header and associated company details
company,accno,accname,amount
abc,123,checking,100
abc,234,saving,200
company,accno,accname,amount
def,678,checking,100
def,222,saving,200
company,accno,accname,amount
dfdf,567,checking,100
dfdf,245,saving,200
and it goes on
my requirement is i need to split the file into multiple files based on company name and each file i split should have contents corresponding to that company as well as header. the splitted files compnay name as well.
file_abc.txt ( file name)
company,accno,accname,amount
abc,123,checking,100
abc,234,saving,200
file_def.txt (file name)
company,accno,accname,amount
def,678,checking,100
def,222,saving,200
file_dfdf.txt ( filename)
company,accno,accname,amount
dfdf,567,checking,100
dfdf,245,saving,200
thanks for the help