Text file -> fixed column -> MySQL DB

Hi !
I have searched in the forum, but i'm not able to combine various solution to help me !
My problem is very simple for a bash scripter or a old linux man, but not for me (novice and inexperienced).
I need to store in a mysql database the output of "last" command, but the table where i need to store the data have only few TEXT fields.
So, i must split the line in a few fixed fields, and store in my mysql db.
The output of "last" command

axel    pts/0        :0.0             Wed Feb  3 21:39   still logged in   
axel    tty7         :0               Wed Feb  3 21:39   still logged in   
mark    pts/2        :0.0             Wed Feb  3 21:37 - 21:38  (00:01)    
axel    tty7         :0               Wed Feb  3 21:34 - 21:38  (00:04)    
reboot  system boot  2.6.31-18-generi Wed Feb  3 21:33 - 00:23  (02:49)    
tucky   pts/0        :0.0             Wed Feb  3 21:18 - 21:33  (00:14)    
tucky   tty7         :0               Wed Feb  3 21:16 - down   (00:16)    
reboot  system boot  2.6.31-18-generi Wed Feb  3 21:15 - 21:33  (00:17)

so I decided to split this way:
For "still logged":

axel,pts/0,:0.0,Wed Feb  3 21:39,still logged in

For "normal":

mark,pts/2,:0.0,Wed Feb  3 21:37 - 21:38,(00:01)

For "reboot or shutdown":

reboot,system boot,2.6.31-18-generi,Wed Feb  3 21:15 - 21:33,(00:17)

In this way I need only 5 fields..

Someone can help me to make this bash shell script ?

Many thanks in advance..
Axel

resolve for your first question.

awk '/still logged in/ {printf "%s,%s,%s,%s %s %s %s,%s %s %s\n", $1,$2,$3,$3,$5,$6,$7,$8,$9,$10; next}' urfile

For rest one, just add more reqeust, such as:

awk '/still logged in/ {printf "format", items; next}
       /reboot/ {printf "format", items; next}
       {printf "format", items}' urfile

Hi rdcwayx , many thanks for your response..

i'm trying, but the first command produce a bad output..

axel,pts/0,:0.0,:0.0 Wed Feb 3 21:39,still logged in   

(duplicate :0.0 )

where am I wrong?

---------- Post updated at 10:49 AM ---------- Previous update was at 09:52 AM ----------

Oh !!
for the first command i have see..

awk '/still logged in/ {printf "%s,%s,%s,%s %s %s %s,%s %s %s\n", $1,$2,$3,$3,$5,$6,$7,$8,$9,$10; next}' urfile

..change the $3 in $4 all is ok..

..I still do not understand the syntax 's last command (how to use %s and $n)

---------- Post updated at 11:17 AM ---------- Previous update was at 10:49 AM ----------

After some tests I found this syntax.. :

awk '/still logged in/ {printf "%s,%s,%s,%s %s %s %s,%s %s %s\n", $1,$2,$3,$4,$5,$6,$7,$8,$9,$10; next}
       /reboot/ {printf "%s,%s %s,%s,%s %s %s %s %s %s\n", $1,$2,$3,$4,$5,$6,$7,$8,$9,$10; next}
       {printf "%s,%s,%s,%s %s %s %s %s %s %s\n", $1,$2,$3,$4,$5,$6,$7,$8,$9,$10}' /my/urfile

..and now how to import in mysql database ?