LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-25-2011, 11:08 AM   #1
Sayan Acharjee
Member
 
Registered: Feb 2010
Location: Chennai, India
Distribution: Manjaro
Posts: 623

Rep: Reputation: 64
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
 
Old 04-25-2011, 11:37 AM   #2
edprochak
LQ Newbie
 
Registered: Apr 2011
Location: Ohio
Distribution: Oracle/RedHat
Posts: 3

Rep: Reputation: 0
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
 
Old 04-25-2011, 11:43 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,127

Rep: Reputation: 5340Reputation: 5340Reputation: 5340Reputation: 5340Reputation: 5340Reputation: 5340Reputation: 5340Reputation: 5340Reputation: 5340Reputation: 5340Reputation: 5340
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Rearrange the column in CSV file.. govi1234 Linux - Newbie 9 08-27-2010 07:15 PM
Redirect output in .xls or csv format jeesun Programming 5 12-25-2009 05:56 PM
send output of namp scan to CSV file rsmccain Linux - Networking 11 04-18-2009 08:31 PM
Combine output of multiple files in one CSV file say_hi_ravi Programming 4 07-17-2008 03:04 AM
Culling Data from a CSV file to output in excel jterr02 Programming 2 05-19-2006 04:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration