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.