open files for writing: file1, file2, file3, file4 for each input file get first input line look at the headers and set up a map of which fields go where while get an input line split it into fields print the fields to the appropriate output files based on the map