how to save output to .csv format??
Hi!
since I'm new to linux, I"m finding it really hard to save my output values to .csv format. I hope you guys can help me. I'm using geany as IDE. I have four analogue inputs to MCP3208 which gives input to my pi, after applying some features my pi returns me a value different for each 4 channels (i-e four values). i am taking 2000 samples. I can see those values in IDE or lxTerminal but i want to save all those values to .csv formatted file so that there is an ease of access. hope to get a reply soon. Thanks. |
CSV is comma separated values. So...
1 2 3 4 becomes "1","2","3","4" You have to reformat the data. AKA programming / scripting 101. Using sed, awk, and a few other things might help simplify the process. |
Simplest is probably "tr" - see the manpage, but if (for example) the data are blank separated this might suffice
Code:
tr " " "," < file.in > file.out |
would be nice to see the original lines and the required output. Just to have an idea what do you really need.
|
The original poster may be more familiar with Windows powershell, which has an "export-csv" command. Powershell operates on objects/arrays/etc, so it makes sense to have an export-csv feature to export an object array.
*nix operates on streams of bytes, though. It's a fundamentally different paradigm. So in *nix, converting to a csv is a low level string manipulation task that depends on the format of what's going in. |
I read somewhere that geany has an export plugin that might be exactly what you want.
ok |
thanks everyone!!
@pan64 i will provide you the code asap. thanks again :) |
All times are GMT -5. The time now is 02:00 AM. |