Help with File Processing

I have a i/p file as

1234568,abcd,12-13-1898,painting,delayed
23424452,bedsd,14-87-2006,delivery

I have to insert pipe(|) in place of commas. ONLY for first three commas. not after that.

PS: There are so many records in the file like this.

Many Thanks!

3 per row or overall? What have you tried so far?

Only for the first three commas.
If there are any more we have to skip.

What actually is the file have four fields which are comman separated. The fourth filed might encounter commas in some cases.

So we have to change the comma separate to Pipe delimiter.

Your explanation seems confusing to me, but I'll assume you want to replace 3 per line, and not 3 per file:

sed 's/^\([^,]*\),\([^,]*\),\([^,]*\),/\1|\2|\3|/' infile

Worked like charm!!!

Can U explain abt this, for me!

sed 's/x/y/' infile
substitutes the first occurrence of y for x on every line of infile.

Regular expressions:
\(...\) stores the matched text for later.
^ by itself is start of line.
[^,] any character that's not a comma.
* zero or more occurances of the previous regexp.

\1 the text that matched the first bracketed ( \(...\) search expression.