Something out of the way though, but I would say you can try this if you have Vim.

1.Simply make a copy of the file and open it in Vim
2.Use this search-and-replace to surround all names with quotes.
%s/\(.*\),\(.*\)/"\1,\2"/g
3. Again a search and replace to put comma at the end of each line.
%s/\n/,\r/g
4.Then record a simple Macro or make it manually as:
:let @q="JJj"
5. Replay the macro N number of times where N >= records or you can say N = (No. of lines/3)
6. Finally remove the commas at the end of each line with the command:
%s/,$//g
Save the file and you are done. Just rename it to <Filename>.csv and the file is ready.
You can probably emit some steps above if you are good at regex by putting comma in first search-and-replace only at the end of names and phone numbers.
Or making a comma in macro itself.
But better forget all that and this simple one would work I believe.
Hope that solves the problem.

In reply to Re: converting txt to csv and formatting by gurpreetsingh13
in thread converting txt to csv and formatting by csorrentini

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.