Replace first 3 occurances of a character in a file for each line

Hi all,

I am very new to unix - ksh. I want to replace some characters in a file with some other, but only for first three occurances for each line.
For eg:
the first 3 occurances character ']' has to be replaced with ',' in each line.

Please help.

thanks
Sreejith

Try:

sed 's/]/,/; s/]/,/; s/]/,/'