MySQL Forums
Forum List  »  Other Migration

CSV field exporting
Posted by: Gerardo Caudillo
Date: January 30, 2013 11:02AM

Hello everyone,

I'm having lots of trouble with the following issue, im trying to export one field data into a new db table, what im trying to do is to delimit each field with commas but when i tried the following:

SELECT * INTO OUTFILE '/tmp/name.csv'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n'
FROM [tablename]

The field which is a log from a cisco router which gives the following output:

| 10.253.28.4 | local7 | info | info | be | 2013-01-15 | 10:58:12 | 144496 | Jan 15 17:11:06.509: %CALLTRKR-6-CALL_R ECORD: ct_hndl=71875, service=TcpClear, origin=Answer, category=Modem, DS0 slot/port/ds1/chan=3/1/1/7, called=7219, calling=55 55952194, resource slot/port=1/52, userid=c000317679330, ip=0.0.0.0, account id=239214, setup=01/15/2013 17:10:14, conn=0.01, phys=9.96, service=20.97, authen=20.89, init-rx/tx b-rate=2400/2400, rx/tx chars=203/153, charged units=0, time=30.36, disc su bsys=CSM, disc code=0x25, disc text=Modem Hang Up, sig type=Unknwn | 536918 |

keeps the fields delimitated by the pipes (|) so i get only 10 fields. I'm trying to get this output exported into an csv so i can re-import it into a new table with different fields. Thanks so much in front for your help.

Options: ReplyQuote


Subject
Views
Written By
Posted
CSV field exporting
5233
January 30, 2013 11:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.