How to Split a source file in specified format?

Requirement: Need to split a source file say a1.txt which can be of size upto 150 MB into 25 target files each with a max size of 25 MB along with the header line in each target file.

NOTE: Few target files can be empty also ,but 25 files must be generated for 1 source file( I can expect upto 80 source files)

Target name format must be :

XXX_YYY1001.CSV , XXX_YYY1002.CSV,�. XXX_YYY1025.CSV

for 2nd source file it must be

XXX_YYY2001�XXX_YYY2025

and so on for 80 th source file it should be

XXX_YYY8001�XXX_YYY8025

So this would be 6 files a 25MB and 19 empty files?
How do you differentiate between 8th and 80th target files?
What have you tried so far?

Hi Rudic we can avoid max 25MB requirement,

Code:
Code used :

awk 'BEGIN{getline f; }{ print > "'$val'" 1 + int (NR%25) ".csv" } ' $original_file

where

$original_file->Source file 
getline f->to get the header line which is appended later to all target files
$val->name of the target file (fixed part of file name stored in table Ex:XXX_YYY1)

The above command generates the target file with names XXX_YYY11, XXX_YYY12 ,�.XXX_YYY125 (I need the names to be XXX_YYY1001,�.XXX_YYY1025 )

If I modify the above code :

awk 'BEGIN{getline f; }{ print > "'$val'" 1001 + int (NR%25) ".csv" } ' $original_file
  • Target files generated are XXX_YYY1001,�.XXX_YYY1025 (But I cannot fix this value since the target file names are different for 80 source files � like XXX_YYY2001�XXX_YYY2025 /XXX_YYY8001�XXX_YYY8025

That post is absolutely unreadable!

Shouldn't the first source file be XXX_YYY0101.CSV
so the tenth source file can be XXX_YYY1001.CSV
and the 20th source file can be XXX_YYY2001.CSV
and the 80th source file can be XXX_YYY8001.CSV

Not sure if I understand much else, but your example naming convention is quite confusing.