Ubuntu – Convert a .txt file in a .csv with a row every 3 lines

command linecsvlibreofficetext processing

Let's say I have a txt file like this:

Mario
mario@me.com
+399038259953
Luigi
luigi@live.com
+395902385093
Yoshi
yoshi@yahoo.com
+81293565291

[and so on for 300 lines…]

How do I make a .ods (or .xls, or .csv, it does not matter) file which has three rows (name, email, phone number)?
I need it so I can easily convert it in a .vcf file and bulk save these numbers in my phone.

Thanks

Best Answer

Use paste to make a csv:

 paste -d,  - - - < file

Output:

Mario,mario@me.com,+399038259953
Luigi,luigi@live.com,+395902385093
Yoshi,yoshi@yahoo.com,+81293565291