Home » Infrastructure » Unix » Is it possible to load data from a text file to other one text file using SQL LOADER?
Is it possible to load data from a text file to other one text file using SQL LOADER? [message #250474] Tue, 10 July 2007 03:35 Go to next message
fortunethiyagu
Messages: 94
Registered: December 2006
Member

Hi,

Is it possible to load data from a text file to other one text file using SQL LOADER?
I knew that from excel we could load the data into Oracle table.
Now i suppose to import from a text file to other text file.. can we do it using SQl LOADER...

-thiyagu
Re: Is it possible to load data from a text file to other one text file using SQL LOADER? [message #250476 is a reply to message #250474] Tue, 10 July 2007 03:47 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
That's not the purpose of a database. You would use an operating system for that. However, with UTL_FILE you can read and write OS files. Perhaps that's more what you're looking for.

MHE
Re: Is it possible to load data from a text file to other one text file using SQL LOADER? [message #250482 is a reply to message #250476] Tue, 10 July 2007 04:14 Go to previous messageGo to next message
fortunethiyagu
Messages: 94
Registered: December 2006
Member

yes. exactly im looking for that.
Just i want to know whether it could be done using loader? have gone through one document, even i tried using input/output as flat file.

it says sql loader is expecting TABLE keyword. now im clear.
so no option in sql loader that do flat to flat transaction.

If possible can anyone provide me the UTL_file program which reads a flat file (that is comma delimited) and write it in other one text file...

-thiyagu

[Updated on: Tue, 10 July 2007 04:20]

Report message to a moderator

Re: Is it possible to load data from a text file to other one text file using SQL LOADER? [message #250485 is a reply to message #250482] Tue, 10 July 2007 04:25 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
The purpose of SQL*Loader is to load a flat file into a database table, nothing more.

Regards
Michel
Re: Is it possible to load data from a text file to other one text file using SQL LOADER? [message #250657 is a reply to message #250474] Tue, 10 July 2007 14:14 Go to previous messageGo to next message
Bill B
Messages: 1971
Registered: December 2004
Senior Member
Your question makes no sense. If you want to copy a flat file to another location in the os then use the OS copy or cp command.
Re: Is it possible to load data from a text file to other one text file using SQL LOADER? [message #250751 is a reply to message #250657] Wed, 11 July 2007 03:03 Go to previous messageGo to next message
fortunethiyagu
Messages: 94
Registered: December 2006
Member

let me make senseful...

I have to read one flat file which has 4 fields and
write it into other one text file, only with 3 fields
based on some sort of filters.

source file willbe in UNIX SERVER-1
Destination file willbe in UNIX SERVER-2
FTP things will happen thru UNIX SCRIPT.

Here i have to do it with oracle procedure to read n write it in a new file.

hope now u got it...

[Updated on: Wed, 11 July 2007 03:05]

Report message to a moderator

Re: Is it possible to load data from a text file to other one text file using SQL LOADER? [message #250752 is a reply to message #250474] Wed, 11 July 2007 03:10 Go to previous messageGo to next message
Cthulhu
Messages: 381
Registered: September 2006
Location: UK
Senior Member
You would be better off with operating system commands such as cut or awk. You could easily cut fields 1,2 and 4 from a comma-delimited file using a command such as:

cut -d"," -f1,2,4 file1.txt > file2.txt


Re: Is it possible to load data from a text file to other one text file using SQL LOADER? [message #250825 is a reply to message #250751] Wed, 11 July 2007 08:12 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
fortunethiyagu wrote on Wed, 11 July 2007 04:03
let me make senseful...

source file willbe in UNIX SERVER-1
Destination file willbe in UNIX SERVER-2
FTP things will happen thru UNIX SCRIPT.



I don't see how you are going to be able to do this as UTL_FILE operates on the server, so you will not be able to read/write to two different unix servers.
Re: Is it possible to load data from a text file to other one text file using SQL LOADER? [message #250960 is a reply to message #250825] Thu, 12 July 2007 01:14 Go to previous messageGo to next message
fortunethiyagu
Messages: 94
Registered: December 2006
Member

cut -d"," -f1,2,4 file1.txt > file2.txt

Can i make use of CAT command instead? coz client said to use such..

[Updated on: Thu, 12 July 2007 01:14]

Report message to a moderator

Re: Is it possible to load data from a text file to other one text file using SQL LOADER? [message #251005 is a reply to message #250960] Thu, 12 July 2007 03:08 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Please take this to a unix forum.
This has nothing to do with Oracle.
Re: Is it possible to load data from a text file to other one text file using SQL LOADER? [message #251242 is a reply to message #251005] Thu, 12 July 2007 13:56 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
http://www.akadia.com/services/ora_important_2000.html
search for "Useful UNIX Utilities to manipulate fixed length records"

awk, perl are commonly used for processing text files.
======================================================================
Split a data file
======================================================================
>cat t.dat
11 hello11
21 hello21
31 hello31
41 hello41

>cat t.ksh
#!/bin/ksh
# lines starting with 1 go to t1.txt
# lines starting with 2 go to t2.txt etc
while read i
do
awk 'substr($1,1,1) == 1 { print $1 > "t1.txt" }
     substr($1,1,1) == 2 { print $1 > "t2.txt" }
     substr($1,1,1) == 3 { print $1 > "t3.txt" }
     substr($1,1,1) == 4 { print $1 > "t4.txt" }'
done < t.dat


Previous Topic: How to get the output from [ -s "abc.txt" ]
Next Topic: Line count problem with FTP option
Goto Forum:
  


Current Time: Mon Nov 25 09:06:45 CST 2024