text file to excel or csv


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting text file to excel or csv
# 1  
Old 04-14-2007
text file to excel or csv

Hi,

I have a text file like

----------------------
aaa|bbb|ccc|ddd|eee
fff|gggg|hhhhhh|kkkk

--------------------

I have a script which will transfer(thourgh FTP) this text file to windows system.

But I want to covert it into excel or CSF then upload into windows system..

thanks
# 2  
Old 04-14-2007
csv? you can convert those "|" into ","
Code:
 sed  -i 's/|/,/g' file

# 3  
Old 04-14-2007
most seds do not have a -i option, so if that is your case:

Code:
tr '|' ',' < file > newfile

upload newfile
or
Code:
sed 's/|/,/g' file > newfile

upload newfile
or
Code:
perl -pi -e 's/|/,/g' file

upload file
# 4  
Old 04-15-2007
Cool..

I got it..

uploading it .csv format to window system, when i open the file it is giving desired format....

Thanks
# 5  
Old 04-15-2007
Quote:
Originally Posted by srikanthus2002
Hi,

I have a text file like

----------------------
aaa|bbb|ccc|ddd|eee
fff|gggg|hhhhhh|kkkk

--------------------

I have a script which will transfer(thourgh FTP) this text file to windows system.

But I want to covert it into excel or CSF then upload into windows system..
[INDENT]
Excel can use any character as a delimiter.

Import that file, as it is, and tell Excel to use the pipe as the delimiter.
# 6  
Old 04-16-2007
Hi John,
good question,

But I have to give a file to client in excel format...( Client don't want to do import stufft as you said)

I think, this would creare your doubt...
# 7  
Old 04-16-2007
Code:
perl -pi -e 's/|/\t/g' filename

save the file with .xls extension. a tab separated file will be treated well by excel
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 sort a column in excel/csv file?

I have to sort the 4th column of an excel/csv file. I tried the following command sort -u --field-separator=, --numeric-sort -k 2 -n dinesh.csv > test.csv But, it's not working. Moreover, I have to do the same for more than 30 excel/csv file. So please help me to do the same. (6 Replies)
Discussion started by: dineshkumarsrk
6 Replies

2. Shell Programming and Scripting

Data formatting in CSV file to EXCEL

Hello friends I want to convert an csv file on unix (which is generated by a ETL application) to a formatted excel sheet like .I have roughly like 28 columns 1)All numbers need to be stored as numbers with leading zeros-like format as text for this column to preserve leading zeroes e.g... (6 Replies)
Discussion started by: etldev
6 Replies

3. Shell Programming and Scripting

How to convert excel file to csv file or text file?

Hi all, I need to find a way to convert excel file into csv or a text file in linux command. The reason is I have hundreds of files to convert. Another complication is the I need to delete the first 5 lines of the excel file before conversion. so for instance input.xls description of... (6 Replies)
Discussion started by: johnkim0806
6 Replies

4. Shell Programming and Scripting

Create an .csv/excel file using shellscript

In my file, i have 4 Product names(For ex:Microsoft excel, Oracle,.Net,IBM websphere,..etc.,) I want this 4 Products in 4 individual .csv/excel file after running the script with those products related information. (12 Replies)
Discussion started by: Navya
12 Replies

5. 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

6. Shell Programming and Scripting

csv file to excel issue

Hi, I am trying to attach and email a csv file in the form of an excel sheet. And I have been successful in doing this. But after some days I realised that some fields in the csv file are also having commas because of which this field is getting splitted in columns in the excel sheet. ... (5 Replies)
Discussion started by: girish1428
5 Replies

7. UNIX for Dummies Questions & Answers

Excel File to CSV

Hi All, I have to convert the excel file which will be placed in the Unix box to a CSV file using a shell script. Please Advise. Thanks & Regards, Kumar66 (1 Reply)
Discussion started by: kumar66
1 Replies

8. Shell Programming and Scripting

How to sort columns in excel(csv) file

i want sort columns with headers based on another file headers file1 eg: i'm having an empty file with only coumn names like lastname firstname title expirydate stlcno status etc... another file with same column names and some other as well but in different order... file2 eg:firstname... (2 Replies)
Discussion started by: Man83Nagesh
2 Replies

9. UNIX for Advanced & Expert Users

how to convert text/csv to excel

Hello All, I have a sql report with 50 columns and 1000 rows result in a file ( txt / csv). is there is any way that we can move them to excel in KSH. Thanks, Sateesh (7 Replies)
Discussion started by: kotasateesh
7 Replies

10. UNIX for Advanced & Expert Users

Problem in converting password protected excel file to csv file in unix

I need to convert a password protected excel file which will be in UNIX server to a comma separated file. For this I need to open the excel file in UNIX box but the UNIX box doesn't prompt for password instead it is opened in an encrypted manner. I could manually ftp the excel file to local... (2 Replies)
Discussion started by: Devivish
2 Replies
Login or Register to Ask a Question