LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to redirect the output to a different column in .csv file (https://www.linuxquestions.org/questions/linux-general-1/how-to-redirect-the-output-to-a-different-column-in-csv-file-876988/)

Sayan Acharjee 04-25-2011 11:08 AM

How to redirect the output to a different column in .csv file
 
Hi,

I was trying to redirect the output of two variables to different columns of a .csv file in MS excel like this,

Code:

echo "$a \t $b" > abc.csv
But I am getting both $a and $b in the same column, is there anything I can use instead of \t to move the value of $b to the next column? Or is there a good different approach to do it?

Thanks

edprochak 04-25-2011 11:37 AM

This is a RTFM question.
The man page for echo describes this option:
-e enable interpretation of backslash escapes

so you need echo -e ...

Ed

michaelk 04-25-2011 11:43 AM

FYI I assume this file will be imported into Excel. I believe that by default Excel assumes that CSV files use a comma and text files use a tab. However, you can specify any character as a column separator when importing.


All times are GMT -5. The time now is 08:51 PM.