Converting excel to '|' delimiter


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Converting excel to '|' delimiter
# 1  
Old 01-31-2012
Converting excel to '|' delimiter

Hi All,


Can you please suggest me how to convert excel format to ‘|' delimiter file. I need to use perl script
Thanks
Rama
# 2  
Old 01-31-2012
Like this?
Code:
root@bt> cat infile
a,b,c,d
root@bt> perl -pne 's/,/|/g' infile
a|b|c|d

--ahamed
# 3  
Old 01-31-2012
Input data
Code:
A|"B,C"|D|E

current script converting
Code:
A|B|C|D|E

I required
Code:
A|B C|D|E

Let me the any idea

Last edited by Franklin52; 01-31-2012 at 10:09 AM.. Reason: Please use code tags for code and data samples, thank you
# 4  
Old 01-31-2012
Raw Microsoft Excel format is unsuitable for processing in any text-based computer language. You can use Excel to export the data with a pipe delimiter. If you have already exported the data in some text file format, please post a representative sample (blotting anything confidential with X's).

(Posts crossed - I had not seen post #3. Was that format written by Microsoft Excel? If so, how?)
# 5  
Old 01-31-2012
Actually I need to convert file name (sample.xls) to “|” delimiter format
Could you please update me the script
# 6  
Old 01-31-2012
Code:
perl -pne 's/,/ /g;s/"//g' infile

This will work for the data provided. But may fail for actual data if there are quotes within the data

--ahamed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Converting fixed width file to pipe delimiter in Linux(red-hat)

Hi, I am facing a typical scenario for AWK command . In HP- UNIX is behave as expected but in red hat linux same awk code is not give the same result. The below code is for convert the fixed width file to pipe delimiter file in HP-unix server. awk code: #!/bin/awk -f NR!=1... (11 Replies)
Discussion started by: brij_abhi
11 Replies

2. Shell Programming and Scripting

Perl Code to change file delimiter (passed as argument) to bar delimiter

Hi, Extremely new to Perl scripting, but need a quick fix without using TEXT::CSV I need to read in a file, pass any delimiter as an argument, and convert it to bar delimited on the output. In addition, enclose fields within double quotes in case of any embedded delimiters. Any help would... (2 Replies)
Discussion started by: JPB1977
2 Replies

3. Shell Programming and Scripting

Error while Converting Excel to CSV using xls2csv

I am using xls2csv to convert a xls file into a regular .csv file. However, while using the command as xls2csv fromfile.xls > tofile.csv I am getting the following error. fromfile.xls is not OLE file or Error I also tried to specify the comma as delimiter but did not help... xls2csv -c\,... (7 Replies)
Discussion started by: dhruuv369
7 Replies

4. Shell Programming and Scripting

Shell Script for converting file to Excel or CSV

Hi I have a dat file which has "n" number of columns. The file is delimited. The number of columns keep varying as the file is generated out of DB queries. Could you please help me in writing a script which will generate a XLS or CSV file out of the dat file. (5 Replies)
Discussion started by: Vee
5 Replies

5. Programming

converting data from excel sheet to oracle using toad

guys i have data in excel sheet , how do i convert that data to database table (2 Replies)
Discussion started by: Gl@)!aTor
2 Replies

6. Shell Programming and Scripting

Converting txt file to Excel file

Hi All, I have a text file with below content. TradeDate Name SecurityMnc ReasonDesc ======================================= 20120501 Robin ABC FO System Defect 20120502 Robin ABC FO System Defect I would want this in an excel file in 4 columns,... (3 Replies)
Discussion started by: robinbannis
3 Replies

7. Shell Programming and Scripting

Converting specific Excel file tabs to CSV in Python

Hi list, This is probably something really simple, but I am not particularly familiar with Python so I thought I would ask as I know that python has an excel module. I have an excel document with multiple tabs of data and graphs. One of the tabs is just data which I require to have dumped to... (8 Replies)
Discussion started by: landossa
8 Replies

8. Shell Programming and Scripting

KSH - Text from input file truncated while converting it to excel

Dear Members, I am using the attached script to convert a input file delimited by '|' to excel. However, while processing the attribute change_reason, the whole content of the text under change_reason is not displayed completely in the cell in excel. It is truncated after only first few words.... (1 Reply)
Discussion started by: Yoodit
1 Replies

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

10. Shell Programming and Scripting

Converting excel to text

Is it possible to convert an excel file into a text file using standard HP UNIX commands? Possibly in K Shell? (5 Replies)
Discussion started by: stevefox
5 Replies
Login or Register to Ask a Question