Set custom separator for sscovert


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Set custom separator for sscovert
# 1  
Old 07-01-2016
Set custom separator for sscovert

Hi all,

I am exporting data from mysql table and need to represent data in xlsx file.
So, i am using below query to export data to csv:

Code:
SELECT * INTO OUTFILE 'OUT.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' FROM $TABLE;

and then using ssconvert to convert from csv to xlsx:

Code:
ssconvert  OUT.csv FILE.xlsx

But the problem is that in the file there is fields where " symbol used so I am getting shift in the fields.

DB View:

Imageimage uploader

CSV View

Imageimage uploader

If I replace FIELDS TERMINATED BY to other symbol or ENCLOSED BY '\"' to other, then i am getting problems with ssconvert command since I can't specify field separator etc, so I am stuck with this issue Smilie

Is here anyone who was using extract data from DB to csv and from csv to xlsx and how such problem was solved?

---------- Post updated at 02:52 PM ---------- Previous update was at 12:49 PM ----------

Hi all,

Maybe it will be usefull for someone, problem has been solved by removin ENCLOSED BY '\"'
This User Gave Thanks to nypreH For This Post:
# 2  
Old 07-01-2016
Thanks for sharing your solution.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Separator

Hello everybody, I'll get one more help I have a cabundle file that I need to separate into 2 parts, the first sequence and the second sequence, I thought of several things but I did not remember anything that could actually accomplish this separation and transform into 2 variables, first... (4 Replies)
Discussion started by: c0i0t3
4 Replies

2. Shell Programming and Scripting

Awk, with separator |

Friends have the following code that is correct. BEGIN { num_reg = 0 suma_iva=0 } { num_reg++ suma_iva=suma_iva+int(substr($0, 103,9)) } END{ printf ("%011d",suma_iva) } I have the following problem, I have to do just that but this time... (4 Replies)
Discussion started by: tricampeon81
4 Replies

3. Shell Programming and Scripting

Help needed with shell script to search and replace a set of strings among the set of files

Hi, I am looking for a shell script which serves the below purpose. Please find below the algorithm for the same and any help on this would be highly appreciated. 1)set of strings need to be replaced among set of files(directory may contain different types of files) 2)It should search for... (10 Replies)
Discussion started by: Amulya
10 Replies

4. Shell Programming and Scripting

[SOLVED] How to set field separator in awk when FS is "||" ?

Dear Experts, How to use field separator in awk , when the field separation is needed as "||" Example: (file1 ) aa || bb || cc || 1234 xx || yy || zz || 1123 Q: If I want to print $3 and $4 only , with using the field separator "||" How to write awk code: (6 Replies)
Discussion started by: rveri
6 Replies

5. Solaris

LC_ALL & LANG are set OK, but others couldn't set locale correctly.

Hi, I have a Solaris (SunOS 5.10) installed, by default with the en_AU.UTF-8 locale. I want to change it to en_US.UTF-8 With AU, I have no issues whatsoever, so I installed the language package and now locale -a shows "en_US.UTF-8". Problem is even with LC_ALL set in etc/default/init, the... (2 Replies)
Discussion started by: asdfg
2 Replies

6. Shell Programming and Scripting

set Net:SSH:Expect timeout and set it again.

SSHing into a machine can take a few seconds, but after I'm in, the commands return quickly. I was wondering if the timeout setting can be changed once I'm logged into the machine. Does anyone know if this can be set on the fly? The problem here is, if I have to set timeout = 10, it'll take 10... (1 Reply)
Discussion started by: mrwatkin
1 Replies

7. UNIX for Dummies Questions & Answers

How to set server's ip address, router, network mask and set if it is an internal or external ip?

Hello, I need to write a program which sets server's ip address, router, network mask. Program also should set if it is an internal or external ip. Maybe someone can help me ? Any information from u is very useful :b: I stopped at .. :( #!/bin/sh A=`hostname -i` echo "server ip address is $A"... (4 Replies)
Discussion started by: zagaruika
4 Replies

8. Shell Programming and Scripting

How to set Field Separator for TCLSH??? :S

Hi, I am having a problem, with setting the FS in TCLSH, maybe someone knows the answer. I have a Tclsh/Tk script, and i´m trying to get all (only) the running processes for the given user like this: foreach process { puts stdout $process; } This also works, but... (2 Replies)
Discussion started by: laptop87
2 Replies
Login or Register to Ask a Question