text file to csv file

I have to read in a text file but I would like to change it to a csv file. So first I place the text file into a container. Then, I replace all the tab space with comma. When I write the file back out, it display the whole line in one column. How would I go about writing each item in its own separate column. Please provide the syntax! Thanks.