converting to csv format

Asked by harry potter

i want to convert the logfile of the following format to csv format

 1 Time(s): [ 0.000000] 0 base 0CB800000 mask FFF800000 uncachable
 1 Time(s): [ 0.000000] 00000-9FFFF write-back
 1 Time(s): [ 0.000000] 1 base 0CC000000 mask FFC000000 uncachable
 1 Time(s): [ 0.000000] 2 base 0D0000000 mask FF0000000 uncachable
 1 Time(s): [ 0.000000] 3 base 0E0000000 mask FE0000000 uncachable
 1 Time(s): [ 0.000000] 4 base 12E600000 mask FFFE00000 uncachable

first column should be till ':'
second from '[' till ']'
third the remaining text

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu util-linux Edit question
Assignee:
No assignee Edit question
Solved by:
harry potter
Solved:
Last query:
Last reply:
Revision history for this message
mycae (mycae) said :
#1

use awk
cat tmp | awk -F: '{print $1 ", " $2 }' | awk -F\] '{print $1 "]," $2}'

Revision history for this message
harry potter (harry123great) said :
#2

that`s all i want