Convert CSV to Tab
I want to convert a file from Comma Separated Value to Tab Separated Value
How can i do that in shell file looks like this name,accountid,address,city,state I want it to displayed like name accountid address city state Please help!!! |
something like?
Code:
sed -e 's/,/\t/g' /tmp/file.csv > /tmp/file.tabbed |
Easiest way is probably:
Code:
sed 's|,|\t|g' infile > outfile rayfordj beat me to it ... |
it works
Thanks Guys |
Also add this to the list:
cat filename.csv | tr "," "\t" If you wish to have the results saved to a file instead of displayed, simply redirect the output to a file: cat filename.csv | tr "," "\t" > newfile Have fun! :D |
Unnecessary cat. You can just do this:
Code:
< filename.csv tr "," "\t" Code:
< filename.csv tr "," "\t" > tabfile |
Quote:
I just would feel more comfortable using it after command. Just like: Code:
tr "," "\t" < filename.csv > newfile |
Quote:
http://sial.org/howto/shell/useless-cat/ That page also explains why I put the STDIN redirection first. |
All times are GMT -5. The time now is 04:38 PM. |