[Solved] Split file using awk

hlow all,
need your advice
i have sample.txt

1252468812,yahoo,3.5
1252468812,hotmail,2.4
1252468819,yahoo,1.2
1252468812,msn,8.9
1252468923,gmail,12
1232468819,live,3.4
1252368929,yahoo,9.0
1252468929,msn,1.2

now i want filtering with awk so output will like this

12524_log.txt

1252468812,hotmail,2.4
1252468819,yahoo,1.2
1252468812,msn,8.9
1252468923,gmail,12
1252468929,msn,1.2 

12324_log.txt

1232468819,live,3.4

12523_log.txt

1252368929,yahoo,9.0

i using

awk -F "," '{close(f);f=$1}{print > f".txt"}' sample.txt

but this not like output i want get substr($1,0,5) not all $1
how i can do that

thx for your advice

---------- Post updated at 08:48 PM ---------- Previous update was at 08:03 PM ----------

done i solve this case

dear all

how to convert my script like this

awk -F "," '{close(f);f=$1}{print > f".txt"}' sample.txt

for using in solaris iam first in solaris so all my script in linux not alot of working in solaris

thx for advice

nawk '{a=substr($0,1,5)"_log.txt"; printf("%s\n",$0) > a}' sample.txt