Convert sql file to csv file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Convert sql file to csv file
# 1  
Old 08-18-2014
Convert sql file to csv file

How to convert name.sql file into name.csv file.

Basically my input source file is .sql file, I need to verify data after the import of that exported sql file.


Thanks for any help.
# 2  
Old 08-18-2014
Post a sample of the file.
# 3  
Old 08-18-2014
Code:
INSERT INTO `contentlet_delta` VALUES ('00000b47-90f4-4c50-a8bd-897136318f42',1,1,0,0,0,'what-is-caster-oil-used-for','2014-07-05 12:27:45','dotcms.org.2789',0,'what-is-caster-oil-used-for',1,'e8a98548-2036-428d-8607-be7d7abe6284',NULL,NULL,NULL,NULL,'SYSTEM_FOLDER','2012-01-30 07:54     :00',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'what-is-caster-o     il-used-for','','What Is Caster Oil Used for','0','Health','Other Health','UKWhatis','','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,N     ULL,NULL,NULL,NULL,NULL,NULL,'[{\"Question\":\"What Can I Take to Keep Me Awake?\",\"URL\":\"what-can-i-take-to-keep-me-awake\"},{\"Question\"     :\"can the baby still gain weight at 26 wks gestation if placenta is not working\",\"URL\":\"can-the-baby-still-gain-weight-at-26-wks-gestatio     n-if-placenta-is-not-working\"},{\"Question\":\"what stop a 2006 jeep liberty air conditioner blower to stop from comming on\",\"URL\":\"what-     stop-a-2006-jeep-liberty-air-conditioner-blower-to-stop-from-comming-on\"},{\"Question\":\"how long do it take to get from fort worth texas to      cuidad juarez chihuahua in a bus\",\"URL\":\"how-long-do-it-take-to-get-from-fort-worth-texas-to-cuidad-juarez-chihuahua-in-a-bus\"},{\"Quest     ion\":\"What Are the Best Fruits to Eat While Dieting\",\"URL\":\"what-are-the-best-fruits-to-eat-while-dieting\"},{\"Question\":\"What Are An     tioxidants Good for\",\"URL\":\"what-are-antioxidants-good-for\"},{\"Question\":\"How to Stay Sober From Alcohol and Other Drugs?\",\"URL\":\"     alcohol-staying-sober\"},{\"Question\":\"How Many Minutes Does it Take to Walk a Kilometre\",\"URL\":\"how-many-minutes-does-it-take-to-walk-a     -kilometre\"},{\"Question\":\"how many hours does it take to get to petersburg va from cowpens sc\",\"URL\":\"how-many-hours-does-it-take-to-g     et-to-petersburg-va-from-cowpens-sc\"},{\"Question\":\"Why Would a Doctor Prescribe Klonopin?\",\"URL\":\"why-would-a-doctor-prescribe-klonopi     n\"}]','[{\"thumbsDown\":\"0\",\"answer_timestamp\":\"1/30/2012  7:54 AM\",\"thumbsUp\":\"0\",\"answerSource\":\"UKWhatis\",\"answer\":\"Casto     r oil is a vegetable oil obtained from the castor bean (Euphorbiaceae). It is a colorless to very pale yellow liquid with mild or no odor or t     aste.\",\"partner\":\"Samasource\"},{\"thumbsDown\":\"0\",\"answer_timestamp\":\"5/31/2011  5:13 AM\",\"thumbsUp\":\"0\",\"answerSource\":\"UK     Whatis\",\"answer\":\"Castor oil has been used for several years to help relieve constipation and in getting rid of worms. It is used in expec     tant women to help bring on labour and also used as a lubricant for preparing leather. Castor oil is a powerful laxative that has a foul taste      and unpleasant side effects. It is also used for sunburn.\",\"partner\":\"Samasource\"},{\"thumbsDown\":\"0\",\"answer_timestamp\":\"9/14/201     0  4:20 PM\",\"thumbsUp\":\"0\",\"answerSource\":\"UKQnA\",\"answer\":\"In the food industry, castor oil (food grade) is used in food additive     s,flavorings, candy (e.g., chocolate), as a mold inhibitor, and in packaging, as an anti inflammatory remedy, laxative, constipation remedy, t     reating skin trauma and disease, childbirth inducer, lubricant and as a torture weapon in the Italian reign of the Blackshirts led by the infa     mous Benito Mussolini.\"}]',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL     ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3.77778,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0     ,0,0,0,0,0,0,0),('00000da6-0407-4168-947b-51591c1f4c46',0,0,0,0,0,'is-it-better-to-obtain-a-masters-when-wanting-to-become-a-criminal-profiler     ','2014-07-04 10:17:40','dotcms.org.2802',0,'is-it-better-to-obtain-a-masters-when-wanting-to-become-a-criminal-profiler',1,'e8a98548-2036-428     d-8607-be7d7abe6284',NULL,NULL,NULL,NULL,'SYSTEM_FOLDER','2011-01-10 21:07:00',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NUL     L,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'is-it-better-to-obtain-a-masters-when-wanting-to-become-a-criminal-profiler','','Is      It Better to Obtain a Masters When Wanting to Become a Criminal Profiler','0','Society','Other','UKQnA','','',NULL,NULL,'',NULL,NULL,NULL,NULL     ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'[{\"Question\":\"What Year Was the Film the House of the Spirits Made\",\"URL\":\"what-year-was     -the-film-the-house-of-the-spirits-made\"},{\"Question\":\"which city is closer to commerce township, mi - westland or ann arbor, mi\",\"URL\"     :\"which-city-is-closer-to-commerce-township-mi-westland-or-ann-arbor-mi\"},{\"Question\":\"can anyone video me without my consent\",\"URL\":\     "can-anyone-video-me-without-my-consent\"},{\"Question\":\"What Kinds of Jobs Were There in the 1800s?\",\"URL\":\"what-kinds-of-jobs-were-the     re-in-the-1800s\"},{\"Question\":\"How do you convince your parents to trust you over a guys house that they don\'t know?\",\"URL\":\"don-t-tr     ust-anyone-over-thirty\"},{\"Question\":\"Why Is Tradition Important?\",\"URL\":\"why-are-traditions-important\"},{\"Question\":\"What is a Co     urt Appointed Parent Coordinator\",\"URL\":\"what-is-a-court-appointed-parent-coordinator\"},{\"Question\":\"Which Monarchs Last Words Were Al     l My Possessions for a MoMent of TiMe\",\"URL\":\"which-monarchs-last-words-were-all-my-possessions-for-a-moment-of-time\"},{\"Question\":\"If      Some Gruns Are Muns And Some Muns Are Duns Then Some Gruns Are Definitely Dun. The Statement Is True Or False\",\"URL\":\"if-some-gruns-are-m     uns-and-some-muns-are-duns-then-some-gruns-are-definitely-dun-the-statement-is-true-or-false\"},{\"Question\":\"What Mark of Punctuation Might      Indicate That More Information Is to Come?\",\"URL\":\"what-mark-of-punctuation-might-indicate-that-more-information-is-to-come\"}]','[{\"thu     mbsDown\":\"0\",\"thumbsUp\":\"0\",\"answer_timestamp\":\"1/10/2011  9:07 PM\",\"answerSource\":\"UKQnA\",\"answer\":\"It may be better to obt     ain a Master\'s degree when you want to become a criminal profiler, but it depends on what the other option is. If the other option is just a      Bachelor\'s degree, then it is probably better to get the Master\'s, but if the other option is a PhD, then it would be better to get the PhD      and not the Master\'s.\"}]',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL     ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0     ,0,0,0,0), ('00001ca8-a7b6-43ba-9ef1-2fabc313dd01',1,1,0,0,0,'how-to-apply-for-a-spanish-passport','2014-07-08 09:50:24','dotcms.org.2789',0,'h     ow-to-apply-for-a-spanish-passport',1,'e8a98548-2036-428d-8607-be7d7abe6284',NULL,NULL,NULL,NULL,'SYSTEM_FOLDER','2011-02-18 00:00:00',NULL,NU     LL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'how-to-apply-for-a-spanish-p     assport','','How to Apply for a Spanish Passport','0','Society','Other Society','UKQnA','','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NUL     L,NULL,NULL,NULL,NULL,NULL,NULL,'[{\"Question\":\"what is your impression of the grandmother in o\'connor\'s a good man is hard to find\",\"UR     L\":\"what-is-your-impression-of-the-grandmother-in-o-connor-s-a-good-man-is-hard-to-find\"},{\"Question\":\"What Country Does the Word Carava     n Come From\",\"URL\":\"what-country-does-the-word-caravan-come-from\"},{\"Question\":\"What Date is American Spring Break\",\"URL\":\"what-da     te-is-american-spring-break\"},{\"Question\":\"will you please give the mobile number or e-mail address of colors tv serial actress sia/natash     a from drama na ana iss dais meri ladoo\",\"URL\":\"will-you-please-give-the-mobile-number-or-e-mail-address-of-colors-tv-serial-actress-sia-n     atasha-from-drama-na-ana-iss-dais-meri-ladoo\"},{\"Question\":\"how do you find an obituary from a funeral home that no longer exists\",\"URL\     ":\"how-do-you-find-an-obituary-from-a-funeral-home-that-no-longer-exists\"},{\"Question\":\"What is Stoning to Death\",\"URL\":\"what-is-ston     ing-to-death\"},{\"Question\":\"How Does a Bill Pass Through Parliament\",\"URL\":\"how-does-a-bill-pass-through-parliament\"},{\"Question\":\     "what factors might have given the brahmins the premier position in the law of manu\",\"URL\":\"what-factors-might-have-given-the-brahmins-the     -premier-position-in-the-law-of-manu\"},{\"Question\":\"What do Air Wardens Wear in World War 2\",\"URL\":\"what-do-air-wardens-wear-in-world-     war-2\"},{\"Question\":\"do i legally have to give back an engagement ring when the relationship ends\",\"URL\":\"do-i-legally-have-to-give-ba     ck-an-engagement-ring-when-the-relationship-ends\"}]','[{\"thumbsDown\":\"0\",\"answer_timestamp\":\"2/18/2011  12:00 AM\",\"thumbsUp\":\"0\",     \"answerSource\":\"UKQnA\",\"answer\":\"You can acquire Spanish citizenship by either, through marriage, parentage or adoption, or five years      of residency as a political refugee but you cannot apply for a passport without proof of Spanish citizenship. For more insight on how to quali     fy for Spanish citizenship, visit <a href=\\\"euskosare.org\\\" target=\\\"_blank\\\" rel=\\\"nofollow\\\">euskosare.org<\\/a>.To apply for a      passport you should make an appointment with the Spanish embassy or Spanish Consulate General, you must go in person to apply for the passport     . Passport applications cannot be made through mail or online with the embassy.\"},{\"answer_timestamp\":\"8/1/2013  11:22 AM\",\"answerSource     \":\"\",\"answer\":\"Spanish passports are only issued to Spanish citizens for the purpose of travel outside Spain, within the European Econom     ic area, Switzerland and a number of other European countries.\",\"partner\":\"AnswersLife123\"}]',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NUL     L,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9.77778,0,0,0,0,0,0,     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

# 4  
Old 08-18-2014
While you have included everything on one line, this is really 2 records
Each records starts with "INSERT INTO....VALUE...

It is actually already comma delimited if your strip out the heading of each line. How many tables are in your sql file?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

2. UNIX for Advanced & Expert Users

Convert CSV file to nested XML file using UNIX/PERL?

we have a CSV which i need to convert to XML using Perl or Unix shell scripting. I was able to build this XML in oracle database. However, SQL/XML query is running for long time. Hence, I'm considering to write a Perl or shell script to generate this XML file. Basically need to build this XML... (3 Replies)
Discussion started by: laknar
3 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

Awk to convert a text file to CSV file with some string manipulation

Hi , I have a simple text file with contents as below: 12345678900 971,76 4234560890 22345678900 5971,72 5234560990 32345678900 71,12 6234560190 the new csv-file should be like: Column1;Column2;Column3;Column4;Column5 123456;78900;971,76;423456;0890... (9 Replies)
Discussion started by: FreddyDaKing
9 Replies

5. Shell Programming and Scripting

Convert CSV file (with double quoted strings) to pipe delimited file

Hi, could some help me convert CSV file (with double quoted strings) to pipe delimited file: here you go with the same data: 1,Friends,"$3.99 per 1,000 listings",8158here " 1,000 listings " should be a single field. Thanks, Ram (8 Replies)
Discussion started by: Ram.Math
8 Replies

6. Shell Programming and Scripting

Convert sql output to csv file via bash tools

hi Can anybody help me with converting such structure into csv file for windows : BAT_ID ID_num CVS_LINE A_SEG SKILL_TO A_CUSTOMER_TYPE --------- ---------- --------------------------------- ---------- ------------------ ----------- 14-MAY-11 777752 ... (4 Replies)
Discussion started by: kvok
4 Replies

7. Shell Programming and Scripting

How to use sql data file in unix csv file as input to an sql query from shell

Hi , I used the below script to get the sql data into csv file using unix scripting. I m getting the output into an output file but the output file is not displayed in a separe columns . #!/bin/ksh export FILE_PATH=/maav/home/xyz/abc/ rm $FILE_PATH/sample.csv sqlplus -s... (2 Replies)
Discussion started by: Nareshp
2 Replies

8. Shell Programming and Scripting

How to convert a excel file to a .csv file from unix script

Hi I have a excel file in unix machine and have to convert it into a .csv file.I have to do this from a unix script.How do we do this? Thanks Abhinav (3 Replies)
Discussion started by: akashtcs
3 Replies

9. Shell Programming and Scripting

How to convert tab delimited file to .csv file

Hi, Can any one please help me in converting a tab delimited file in .csv file. Records in my file are similar to mentioned below: DET 001 0201 AC032508970 01478E1X8 DET 002 0202 AC032508971 01478E1X8 Could any one please suggest me what approach would be more suitable for this or if... (5 Replies)
Discussion started by: dtidke
5 Replies

10. Shell Programming and Scripting

script to convert CSV to SQL

I am trying to write a script to convert csv files into SQL format. What I am missing is: 1. handling of the first row and create it as a insert into format 2. better handling of any other row, and create a line with the data. *The while read line needs a better work. I thought of using awk. ... (1 Reply)
Discussion started by: saariko
1 Replies
Login or Register to Ask a Question