Separate records of a file on 2 types of records

Hi I am new to shell programming in unix
Please if I can provide help.
I have a file structure of a header record and "N" detail records.
The header record will be the total number of detail records
I need to split the file in 2:
One for the header
Another for all detail records
Could you tell me how it can be done
Thank you very much,:slight_smile:

Is that a "normal" *nix text file? Then the easiest way would be to use head and tail (see their respective man pages) e.g.

head -1 file > headerfile
tail -n +2 file > recordsfile