How to store the flat file in an excel sheet


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to store the flat file in an excel sheet
# 1  
Old 01-29-2009
How to store the flat file in an excel sheet

Hi,

I need to automate a script.
The process in the script is as follows
Running the script abc.ksh
The report is stored in xyz (flat file)
Need to store the flat file content in an excel sheet.

Your reply is highly appreciated.

Thanks,
Karthick
# 2  
Old 01-29-2009
Is you file Comma separated values (CSV)? if not you will have to convert it to...
then save the file with .csv extention
# 3  
Old 01-29-2009
Hammer & Screwdriver A question I was in fact thinking about this morning.

I can think of two ways to accomplish this.
If the infile is like
1234567890abcdeABCDE
where I want to break up field1 as 10, filed2 as 5, field3 as 5
[Note, I just typed the following, and am not sure if I have all the syntax perfect.]

Comments on what would be the better route to take?


(1) Using awk on one-line
Code:
awk '{print substr($0,1,10),","substr($0,11,5),",",substr($0,16,5)}' infile >outfile.csv

or
(2) Using awk but as a script
Code:
awk -v output="outfile.csv" '{
  aa=substr($0,1,10)
  ab=substr($0,11,5) 
  ac=substr($0,16,5)
  print aa","ab","ac >output
} ' infile

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to convert text file into Excel sheet

:cool:Hi, Iam new to this Scripts and forum too. Plz excuse if may i ask silly questions now and further.. Prob: i need to convert txt files data into excel sheet. Suppose if i have hour-wise data in txt file1 and file2 like file1 file2 00: 140 00: 235 01: 160 01:415... (1 Reply)
Discussion started by: mrudula
1 Replies

2. Shell Programming and Scripting

Summing up the data from different excel sheet into one excel sheet

Hi Folks, Can you please advise for any script in unix such that for example , i have 3 different excel sheet at the location /ppt/gfr/exc so the name s of the excel sheet are 1excel.xslx 2excel.xslx 3excel.xslx now in these 3 different excel sheet there is lot of data for example each... (3 Replies)
Discussion started by: punpun66
3 Replies

3. Shell Programming and Scripting

Shell Script for copying text file to Excel Sheet

Hi, I want to write a program to copy a log file to Excel sheet. Excel sheet has four columns MethodName , Code , Description, Details and Time. I want to pick these info from text file and put it in excel sheet. here is how the text file looks - 04.17.2014 08:06:12,697... (1 Reply)
Discussion started by: hershey
1 Replies

4. Shell Programming and Scripting

Perl : to get all the hyperlinks from the xlsx sheet(hyperlinks not visible in excel sheet directly)

Hi folks, I have a requirement in perl to print all the hyperlink from the spreadsheet(xlsx). Spreadsheet contains few lines of hyperlink data (pic attached). P.S. Hyperlink is behind the data and not visible in excel sheet directly. Now using perl script I need to copy the hyperlinks in... (3 Replies)
Discussion started by: scriptscript
3 Replies

5. Shell Programming and Scripting

Copy Data from CSV file to Excel Sheet using Perl

Hi All, Firstly I will like to wish A Happy New Year to all. Now my issue is I have one csv file say(data.csv) and one excel file say(result.xls) The result.xls contains two sheet name Sheet1 and Sheet2, Now What I am trying to do is to First I want to delete that data of Sheet2 if present any,... (6 Replies)
Discussion started by: adisky123
6 Replies

6. Shell Programming and Scripting

a shell script to generate an excel sheet from a text file..

hi, i have a text file that looks like this! i want to generate an excel sheet out of it, removing all the junk data except the addresses that look like . Arrow Electrical Services Rotating Machinery, Electrical Contracting & Mining Specialists Onsite maintenance, breakdown... (8 Replies)
Discussion started by: vemkiran
8 Replies

7. Shell Programming and Scripting

Store a column from an excel sheet (exported to txt) into a variable

I typically pull a bunch of data via SQL that lists a bunch of users and the server on which they want to access, as well as other attributes, in one row of an excel sheet and the number of rows is directly proportionate to the number of users. I'm trying to write a loop to read each line of the... (2 Replies)
Discussion started by: MaindotC
2 Replies

8. Red Hat

HOWTO transfer Hosts in excel sheet to file in LINUX?

Hi guys! I have around 300 hostsname is excelsheet in one column. These hosts I want to add in one file in linux one after the another like hostname1,hostname2.hostname3, I don't want to waste enter it manually it very time consuming, so how to transfer these files from excelsheet to a... (1 Reply)
Discussion started by: manalisharmabe
1 Replies

9. Shell Programming and Scripting

mail a csv file as an excel sheet!

Hi, The result of a script is a csv file in the following format: cat $file_name DATA_USAGE_FACT,YES_NO_FLG,TARGET_TABLE,YES_NO_FLG,1,0,15,0 DATA_USAGE_FACT,DATE_OF_CREATION,TARGET_TABLE,DATE_OF_CREATION,29,9,19,0 DATA_USAGE_FACT,UPDATION_DATE,TARGET_TABLE,UPDATION_DATE,29,9,19,0... (3 Replies)
Discussion started by: dips_ag
3 Replies

10. Shell Programming and Scripting

store the table data in excel file

Hello - I have a below table and i want to extract the data into excel sheet and send to different location. Here is the table structure... SQL> desc t_i1_exportdocs Name Null? Type ----------------------------------------- --------... (11 Replies)
Discussion started by: govindts
11 Replies
Login or Register to Ask a Question