I get a file which is probably in hexadecimal character which i have to load in oracle. oracle is unable to process the original file but when i copy the content into notepad it works fine.
How can i achieve in unix to copy content of file into .txt file instead of cp command as cp command will just copy the file itself.
Hope my doubt is clear.
I want to open the file and do select all -> copy -> past in new file without cp command.
If you mind explaining by what magic you used to open your file ( you must have no?) to copy the content in notepad ? As for us all this isnt clear... And what makes you thing you have Hexa char?
Remembering your other recent thread, I guess it might be a question of encoding, e.g. UTF16, not a file "containing hexadecimal" chars. I faintly remember windows creating UTF16 encoded files; where do your files come from?
Please ALWAYS post sample data so people can see and analyse what your problem might be!
I am not sure what is the problem with the file and i just guessed that it might have hexa decimal char. when processing the file it shows no data in oracle but when i copy the full content of file in another file then it works well. seeing the data from naked eye will not catch any issue arising from the content of the file.
below is the sample data from original file.
<EVENT_LOCATION>^M
00;"0";"---"^M
01;"1";"A-car"^M
02;"2";"B-car"^M
03;"3";"C-car"^M
04;"4";"D-car"^M
05;"5";"D1-car"^M
06;"6";"C1-car"^M
07;"7";"B1-car"^M
08;"8";"A1-car"^M
<CODE_0>^M
0000;"";""^M
<PRIORITY>^M
05;"";""^M
01;"";""^M
03;"";""^M
02;"";""^M
04;"";""^M
<EVENT>^M
31;198;"MDLF_DELTA_SIGMA_TEST_2_HCD";"COP Delta Sigma Test Error AI2";A;B;;ON;OFF;"ENV_FAULT"^M
31;185;"MDLF_ANALOG_INPUT_TEST_1_HCD";"COP Analog Input Test Error AI1";A;B;;ON;OFF;"ENV_FAULT"^M
31;171;"MDLF_No_Error_DSP2_HCD";"COP DSP2 self test passed";A;B;;ON;OFF;"ENV_FAULT"^M
31;156;"MDLF_SUP_IREF_RANGE_HCD";"COP internal error (IREF range)";A;B;;ON;OFF;"ENV_FAULT"^M
31;153;"MDLF_POWER_SUPPLY_SUP_TEST_HCD";"COP internal error (power supply test)";A;B;;ON;OFF;"ENV_FAULT"^M
31;14D;"MDLF_STACK_OVERFLOW_HCD";"COP internal error (stack overflow)";A;B;;ON;OFF;"ENV_FAULT"^M
31;14C;"MDLF_CYCTIMESUP_HCD";"COP internal error (DSP overrun)";A;B;;ON;OFF;"ENV_FAULT"^M
31;0C6;"SCU_ST_IEEPROM_ERR_HCD";"COP internal error (internal EEPROM)";A;B;;ON;OFF;"ENV_WARN"^M
31;0C1;"SCU_ST_WD_ERR_HCD";"SCU selftest: watchdog error";A;B;;ON;OFF;"ENV_WARN"^M
31;09D;"MD_BLUELIMIT_RB_AI1_2_STOP_HCD";"STOP: bluelimit counter reed band AI1/2";A;B;;ON;OFF;"ENV_TRIP"^M
31;08E;"MD_TRT_INTERVAL_EXC_HCD";"STOP: Selftest interval 2 is crossed";A;B;;ON;OFF;"ENV_TRIP"^M
31;07B;"MD_IH_RMS_MAX_4_HCD";"RMS Max 4 threshold of heat current exc";A;B;;ON;OFF;"ENV_TRIP"^M
31;072;"MD_II_RMS_MAX_3_HCD";"RMS Max 3 threshold of roof current exc";A;B;;ON;OFF;"ENV_TRIP"^M
31;05E;"MD_DI5_WHILE_MCB_HCD";"DI5 is on while MCB is on (feedback)";A;B;;ON;OFF;"ENV_TRIP"^M
2E;188;"MDLF_ANALOG_INPUT_TEST_4_HCA";"COP Analog Input Test Error AI4";A;B;;ON;OFF;"ENV_FAULT"^M
There is a system which generate this file and it comes form our network cloud.
Why is "oracle ... unable to process the original file"? What's the error messages and the result? What's the difference between this file and the one that "works fine"?
And, did you apply the solution to your recent problem before working with the file? The <CR> (^M, 0x0D) char might give a problem, then...
Oracle can open the file but shows null data in all the rows but when taking the length of the column then it shows there is indeed some data which looks like non printable data.
some magic happens when i copy the content into different file by selection all the data from original file.
Out team has agreed to do copy form origianl file and pput it in another file before processing.
so all i want is to read line by line from original file and write in new file line by line.
So you opened the file with notepad and saved from notepad as a .txt ? In which case RudiC may hit the pin: opening with notepad will automatically convert the content and more remove some encoding is doesnt like, I have from time to time some trouble with file utilizing different encoding, so I have writen scripts to convert to what I need, e.g. I get a file in UTF-8, only I need iso-8859-1...
You need to know what encoding is used for your file, then what is used on your box, then look at the iconv man pages for a start
The file -i option explicitly tells file not to investigate the contents of the file named by an operand if that file is a regular file. Why don't you leave off the -i and try the command again (as RudiC suggested)?