Writing multiple outputs in to separate cells of CSV file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Writing multiple outputs in to separate cells of CSV file
# 1  
Old 07-03-2014
Writing multiple outputs in to separate cells of CSV file

Hi I am writing a script which has multiple awk statements and each statement gives me a numeric count as an output.
I want those output to be stored in different cells of a csv file.

say 12 awk statements give 12 output and i want them in diffrenet cells of csv file.


Thank you guys..!!
# 2  
Old 07-03-2014
Did you try anything?
# 3  
Old 07-03-2014
Code:
awk -F , 'BEGIN{count1=0;count2=0;print "Number of empty lines in each file"} NR==FNR{if(NF==0) count1++;f1=FILENAME} NR!=FNR{if(NF==0) count2++;f2=FILENAME}
 END{printf "%s,%s,\n%s,%s\n\n",f1,f2,count1,count2}' u.txt u1.txt > summary.csv

here output is written to separate cells but i wanted them to be written to specific cells say sheet2!A15

anyways i am writing Macro for nw.. :P

Last edited by Scrutinizer; 07-03-2014 at 02:57 PM.. Reason: CODE tags
# 4  
Old 07-03-2014
I don't think it's possible in the text file (not a csv, anyway - maybe if you were writing ODF or similar).

You might be able to do something on the Excel end with the text import wizard (or just write a macro, as you say).
# 5  
Old 07-03-2014
1 .csv file will be imported into 1 sheet. It is not designed to address cells in other sheets, nor to address random cells. If you want an entry into A15, you need to do it like
Code:
,,,,,,,,,,,,,data

 
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 Dump data into CSV file which is Separate by <tab>?

Dear Team, please help me to solve this problem using Linux command. I want to dump this data into an excel sheet, Suppose I have a string like: ABC PQR XYZ ASD then I expect output as a ABC XYZ PQR ASD (3 Replies)
Discussion started by: Shubham1182
3 Replies

2. Shell Programming and Scripting

Consolidating multiple outputs in one file

Dears, i am stuck here i have 3 scripts running at one time and all the three scripts finish at different time and each script generate 1 file with different name. so i will have three files. i dnt know which script finish first i want to have a script which check if all the there files are... (6 Replies)
Discussion started by: mirwasim
6 Replies

3. Shell Programming and Scripting

How to separate data coming in one column of CSV file?

I am running an ISQL command on Sybase DB and getting output of a query in an CSV file. The issue is that all the data comes in to the same column, i want them to be separated in different columns. SQL_COMMAND=command.sql file=file.txt formatFile=formatFile.txt report=report.csv echo... (1 Reply)
Discussion started by: Sharma331
1 Replies

4. Shell Programming and Scripting

Csv file separate using awk

Hi, I have file like below apple,orange,pineapple,pappya,guva,avocado want to store as apple orange pineapple pappya I tried below command to seprate first field command1: (3 Replies)
Discussion started by: stew
3 Replies

5. Shell Programming and Scripting

Need help with awk statement to break nth column in csv file into 3 separate columns

Hello Members, I have a csv file in the format below. Need help with awk statement to break nth column into 3 separate columns and export the changes to new file. input file --> file.csv cat file.csv|less "product/fruit/mango","location/asia/india","type/alphonso" need output in... (2 Replies)
Discussion started by: awk-admirer
2 Replies

6. Shell Programming and Scripting

Reading from a CSV and writing in same CSV file

Hi, I am tryng to read from a csv file and based on some grep command output I will modify one of the column in the same csv. Example:- Input CSV:- 20120829001415,noneAA,google.com 20120829001415,dfsafds,google.com 20120829001415,noneAA,google.com Intermediate Step:- If 2nd column of... (3 Replies)
Discussion started by: kmajumder
3 Replies

7. Shell Programming and Scripting

Need help in writing a routine for sorting a CSV file

Hi, I have a CSV file in following manner: server1,env1,patch1 server1,env1,patch2 server1,env1,patch3 server1,env2,patch1 server1,env2,patch3 server2,env3,patch1 server2,env3,patch5 server2,env4,patch1 server3,env6,patch1 server3,env7,patch2 server3,env7,patch3 I want to... (6 Replies)
Discussion started by: avikaljain
6 Replies

8. Shell Programming and Scripting

Add color in CSV cells

hi, i have text file that file contains below information. Name,Roll,Mark,Total Sivasankar,2120,89,410 Raja,2212,87,425 i need to convert text file to CSV file also the heading(Name,Roll,Mark,Total) font should be BOLD and color should be RED. how can i set fonts in csv (5 Replies)
Discussion started by: rsivasan
5 Replies

9. Shell Programming and Scripting

How to create a CSV File by reading fields from separate files

SHELL SCRIPT Hi, I have 3 separate files within a folder. Every File contains data in a single column like File1 contains data mayank sushant dheeraj File2 contains DSA_AT MG_AT FLAT_09 File3 contains data 123123 232323 (2 Replies)
Discussion started by: mayanksargoch
2 Replies

10. Shell Programming and Scripting

writing to a csv file

Hi buddies i have doubt. I 'm new to unix script and learning. I have a req. I need to find the values mentioned in the double quoutes of each line and write it into a csv file. How do I handle this? Please help me. SCTY_ISS_ID (SCTY_ISS_ID:Dec18Fixed.0:): "37927320080309" TRD_DT... (6 Replies)
Discussion started by: pstanand
6 Replies
Login or Register to Ask a Question