Split the all files in to 8 parts in a folder

Hi,

I have different files and i need to split the files in that folder split in to 8 parts with equal number of lines....!
any fastest way of doing this in awk.

for an example i have a file called "BillingDetails_BaseFile.csv" with total line count 65536 and i need to split in to 8 parts with each file having 8192 (8192*8=65536). if 65538,last two lines can be ignored. i had a logic for this but its taking long time for this.
any fastest way in awk is appreciated.

my code:

cd /tmp/data/
linecount=$(wc -l BillingDetails_BaseFile.csv|cut -d" " -f1)
echo "linecount=$linecount"
b=$(expr  ${linecount} / ${Split_Count} )
echo "spliting lines per file will be ${b}"
split -l${b} -d BillingDetails_BaseFile.csv BillingDetails_
chmod 777 *

c=$(expr  ${Split_Count} - 1  )
for (( i=${c}; i>=0; i-- ))
do
  a=$({ printf "%02d\n" $i ; })
  b=$(expr  ${i} + 1  )
  b=$({ printf "%02d\n" $b ; })
  mv BillingDetails_$a BillingDetails_$b
done

any fastest way just specifying the folder name it should go each file and look for line count and split the 8 parts with equal number of lines.
Any help in awk is appreciated.

I don't think switching to awk will speed up things dramatically if at all, as it won't be faster than the designed-for-the-task split command. In either case you'll need to scan through the entire file to calculate its line count, and then again to do the split.
Why not optimize what you got above, reducing it to the single command

split -l$(($(wc -l <BillingDetails_BaseFile.csv) / Split_Count)) --numeric-suffixes=01 BillingDetails_BaseFile.csv BillingDetails_

(given your OS and shell versions (which you fail to mention) offer the features used)?