Unix Comma Separated to Excel Column


 
Thread Tools Search this Thread
Special Forums UNIX Desktop Questions & Answers Unix Comma Separated to Excel Column
# 1  
Old 07-30-2008
Unix Comma Separated to Excel Column

I would like to copy 2 parts of a csv file from Unix to an XL sheet. However to save time I do not want to format the column ever time I cut and paste into XL(Text2Column). I've used awk -F, '{Print $1, $2....}'. Is there a script or code that can automatically format the csv for XL columns?

Sample CSV
00:10,2344,2332,0,1,0,2,0
00:15,2311,2002,0,0,0,1,0
Sample XL
00:10|2344|2332|0|1|0,2|0
---------------------------
00:15|2311|2002|0|0|0|1|0

Last edited by ravzter; 07-30-2008 at 03:56 AM.. Reason: missing example
# 2  
Old 07-30-2008
# 3  
Old 07-30-2008
Thank you Ygor, I will give it a go and report back any issues.
# 4  
Old 07-31-2008
I've used the script below

A.
BEGIN { FS = ","
RS = "\n"
OFS="\t"
}
{
print $1, $2, $3, $4, $5
}

Followed by

B.
awk -f abc < report.csv > report.xls

This generates the report I'm looking for, excellent!!!

However I now have some other questions

1. I would like the B. script above to find the csv file for the current day and convert that into the Excel format. The CSV file usual ends with a date format like: f_Jul30.csv.
How would I do this?

2. I would like to automatically insert a column into the excel sheet that would perfmon a1/(b1-k1) and result in a percentage value. Reason I cant do it from the original is because it's run from root.

3.How would I tranfer it from Linux to Windows?

Thanks!

Last edited by ravzter; 07-31-2008 at 05:13 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to extract fields from a CSV i.e comma separated where some of the fields having comma as value?

can anyone help me!!!! How to I parse the CSV file file name : abc.csv (csv file) The above file containing data like abv,sfs,,hju,',',jkk wff,fst,,rgr,',',rgr ere,edf,erg,',',rgr,rgr I have a requirement like i have to extract different field and assign them into different... (4 Replies)
Discussion started by: J.Jena
4 Replies

2. Shell Programming and Scripting

Parsing Comma Separated values to UNIX variable from PLSQL

Hi All, I'm trying to pass the comma separated values (string) returned from Plsql Procedure to UNIX variable. getting the below log message cat: -: Bad file descriptor awk: cmd. line:1: fatal: error reading input file `-': Bad file descriptor The output coming from plsql procedure is... (3 Replies)
Discussion started by: Mahesh3089
3 Replies

3. Shell Programming and Scripting

awk to parse comma separated field and removing comma in between number and double quotes

Hi Experts, Please support I have below data in file in comma seperated, but 4th column is containing comma in between numbers, bcz of which when i tried to parse the file the column 6th value(5049641141) is being removed from the file and value(222.82) in column 5 becoming value of column6. ... (3 Replies)
Discussion started by: as7951
3 Replies

4. Shell Programming and Scripting

Convert column to quote and comma separated row

Hi, I have a list of tables in a file.txt C_CLAIM C_HLD C_PROVIDER I want the output to be 'C_CLAIM','C_HLD','C_PROVIDER' Currently I'm usin awk and getting output which is almost correct but still has minor defects awk -vORS="','" '{ print $1 }' file.txt The output of... (4 Replies)
Discussion started by: wahi80
4 Replies

5. UNIX for Dummies Questions & Answers

[solved] Comma separated values to space separated

Hi, I have a large number of files which are written as csv (comma-separated values). Does anyone know of simple sed/awk command do achieve this? Thanks! ---------- Post updated at 10:59 AM ---------- Previous update was at 10:54 AM ---------- Guess I asked this too soon. Found the... (0 Replies)
Discussion started by: lost.identity
0 Replies

6. Shell Programming and Scripting

Need Help - comma inside double quote in comma separated csv,

Hello there, I have a comma separated csv , and all the text field is wrapped by double quote. Issue is some text field contain comma as well inside double quote. so it is difficult to process. Input in the csv file is , 1,234,"abc,12,gh","GH234TY",34 I need output like below,... (8 Replies)
Discussion started by: Uttam Maji
8 Replies

7. Shell Programming and Scripting

Comma separated file

Hi all, I have the following files types: FileA: 100, 23, 33, FileB: 22, 45, 78, and i want to make File C: 100,22 23,45 33,78 any nice suggestions for making it easy. (3 Replies)
Discussion started by: hen1610
3 Replies

8. Shell Programming and Scripting

Extract comma separated value in unix

Hello All Can anyone please guide me how to solve the issue In the below code I am getting concat of two value in result variable with comma separated result=`sqlplus -s / <<EOF set pages 0 feed off; set feedback off; spool abc.txt select... (4 Replies)
Discussion started by: Pratik4891
4 Replies

9. Shell Programming and Scripting

Deleting a column in multiple files that are comma separated

Hi, I have a directory that contains say 100 files named sequencially like input_1.25_50_C1.txt input_1.25_50_C2.txt input_1.25_50_C3.txt input_1.25_50_C4.txt .. .. .. input_1.25_50_C100.txt an example of the content in each of the file is: "NAME" "MEM.SHIP" "cgd1_10" "cgd1_10"... (9 Replies)
Discussion started by: Lucky Ali
9 Replies

10. Shell Programming and Scripting

Unix shell script to parse the contents of comma-separated file

Dear All, I have a comma-separated file. 1. The first line of the file(header) should have 4 commas(5 fields). 2. The last line of the file should have 1 comma(2 fields). Pls help me in checking this condition in a shell script. And the number of lines between the first line and last... (11 Replies)
Discussion started by: KrishnaSaran
11 Replies
Login or Register to Ask a Question