Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

how to export file which field delimited by "^A "

avatar

Hi There,

 

my file is "^A " delimted which i want to export using sqoop . do you know how can we handle such special charater .

1 ACCEPTED SOLUTION

avatar
Mentor

The "^A" is a visual shell representation of the ASCII hexadecimal byte "01".

 

You can run your command as so, making use of the actual byte representation than a visual helper:

 

sqoop export --connect jdbc:oracle:thin:olap7964/olap7964@192.168.2.135:1521:ORCLOBIA11G --username XXXXXXX --password XXXXXXX --export-dir /user/hive/warehouse/abc.db/sach_sport --table SACH_SPORT --fields-terminated-by $'\x01' -m 1

View solution in original post

6 REPLIES 6

avatar
Contributor

Can you try using '\' as '\^A'

avatar

It is not working.. pfb log for your refernece . 

 

 

hduser@jgusbihdpmaster:/tmp$ sqoop export --connect jdbc:oracle:thin:olap7964/olap7964@192.168.2.135:1521:ORCLOBIA11G --username XXXXXXX --password XXXXXXX --export-dir /user/hive/warehouse/abc.db/sach_sport --table SACH_SPORT --fields-terminated-by '\^A' -m 1 Warning: /opt/cloudera/parcels/CDH-5.5.1-1.cdh5.5.1.p0.11/bin/../lib/sqoop/../accumulo does not exist! Accumulo imports will fail. Please set $ACCUMULO_HOME to the root of your Accumulo installation. 16/06/20 03:37:39 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.5.1 16/06/20 03:37:39 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead. Cannot understand character argument: \^A

avatar
Contributor

Can you try:

 

 TERMINATED BY '\136'

avatar

Nope.. Same error.. 

avatar
Mentor

The "^A" is a visual shell representation of the ASCII hexadecimal byte "01".

 

You can run your command as so, making use of the actual byte representation than a visual helper:

 

sqoop export --connect jdbc:oracle:thin:olap7964/olap7964@192.168.2.135:1521:ORCLOBIA11G --username XXXXXXX --password XXXXXXX --export-dir /user/hive/warehouse/abc.db/sach_sport --table SACH_SPORT --fields-terminated-by $'\x01' -m 1

avatar

yeah... its working..

 

i  was able to find out its hex value (its control-v + control-a) character but was not applying '$' symbol.

 

Thank you so much .. 🙂 

 

really appreciated..