Sponsored Content
Top Forums Shell Programming and Scripting shellscript to read data from txt file and import to oracle db Post 302583613 by jayan_jay on Wednesday 21st of December 2011 12:51:49 AM
Old 12-21-2011
Placing sqlplus within while loop wont be a good idea ...

Try with the below modified one ..
Code:
[ -f "dir.txt" ] && echo "File present" || exit 1
while read line
do
      << your variable declaration code >>
      echo "<< your full sql insert code >> " >> /your/path/to/insert_query.sql
done < dir.txt
 
##Here connect the DB to insert 
 
sqlplus -s username/password <<EOF
set scan off;
@/your/path/to/insert_query.sql
exit;
EOF

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Import data from compressed file

HI I need to import data from a file which is in comressed format but system doesn't have enough space to uncompress file Is there any way so that i can do import from compressed file. (4 Replies)
Discussion started by: ap_gore79
4 Replies

2. Shell Programming and Scripting

txt file to oracle database

hiya, i have a query: i want to read a file which contains: 2005/02/21 16:56:54.301: 111 PS (200, 10) sent <log instrument="FXA.ROSS"... (9 Replies)
Discussion started by: jorhul
9 Replies

3. Shell Programming and Scripting

shellscript.query Oracle table..populate in a text file

Hi Guys, I'm new to this forum as well as to UNIX shell scripting. I'm looking for a shellscript to query an Oracle database table and populate the result set of the query in a text file. Could you someone help me out with a sample code? Thanks, Bhagat (7 Replies)
Discussion started by: bhagat.singh-j
7 Replies

4. Programming

import .txt and split word into array C

Hi, if I want to import .txt file that contain information and the number separate by space how can I split and put into array In C Example of .txt file 3 Aqaba 49789 10000 5200 25.78 6987 148976 12941 15.78 99885 35262 2501 22.98 Thank (3 Replies)
Discussion started by: guidely
3 Replies

5. Shell Programming and Scripting

Want to read data from a file name.txt and search it in another file and then matching...

Hi Frnds... I have an input file name.txt and another file named as source.. name.txt is having only one column and source is having around 25 columns...i need to read from name.txt line by line and search it in source file and then save the result in results file.. I have a rough idea about the... (15 Replies)
Discussion started by: ektubbe
15 Replies

6. Shell Programming and Scripting

How to import a value from txt file

Hello, I want to give a value from a txt file to my variable at my ksh script. I`ve searched on the net and I found the command variable < file.txt but it cannot see the file. The .txt file contains two values in the first and the second line. Is there any way to give the first-line value to... (1 Reply)
Discussion started by: chris_euop
1 Replies

7. UNIX and Linux Applications

How to import and dump file to remote Oracle server?

Hi All, I have a linux centos instance which has a dump file. I need to import the dump file to the oracle server which is located at some remote location. I have installed the oracle client on my machine and I am able to connect to the remote oracle server. Now how to import the dump to the... (3 Replies)
Discussion started by: Palak Sharma
3 Replies

8. Homework & Coursework Questions

Oracle dump file (del format) import into db2

1. The problem statement, all variables and given/known data: are the oracle dump files compatible to direct import into db2? I already tried many times but it always truncated results. anyone can help/ advice or suggest? 2. Relevant commands, code, scripts, algorithms: exp... (3 Replies)
Discussion started by: Sonny_103024
3 Replies

9. Shell Programming and Scripting

How to get the shell script to read the .txt file as an input/data?

i have written my shell script in notepad however i am struggling to pass the data file to be read to the script the data file is of .txt format. My target is to run the shell script from the terminal and pass 3 arguments e.g. polg@DESKTOP-BVPDC5C:~/CS1420/coursework$ bash valsplit.sh input.txt... (11 Replies)
Discussion started by: Gurdza32
11 Replies

10. UNIX for Beginners Questions & Answers

Using bash script : How to Import data from a dsv file into multiple tables in mysql

HI I have a dsv file that looks like: <<BOF>> record_number|id_number|first name|last name|msisdn|network|points|card number|gender 312|9101011234011|Test Junior|Smith|071 123 4321|MTN|73|1241551413214444|M 313|9012023213011|Bob|Smith|27743334321|Vodacom|3|1231233232323244|M... (4 Replies)
Discussion started by: tera
4 Replies
File::Fu(3pm)						User Contributed Perl Documentation					     File::Fu(3pm)

NAME
File::Fu - file and directory objects SYNOPSIS
The directory constructor: use File::Fu; my $dir = File::Fu->dir("bar"); print "$dir "; # 'bar/' my $file = $dir + 'bar.txt'; print "$file "; # 'bar/bar.txt' my $d2 = $dir % 'baz'; # 'barbaz/' my $d3 = $dir / 'bat'; # 'bar/bat/' my $file2 = $dir / 'bat' + 'foo.txt'; # 'bar/bat/foo.txt' The file constructor: my $file = File::Fu->file("foo"); $file->e and warn "$file exists"; $file->l and warn "$file is a link"; warn "file is in ", $file->dir; ABOUT
This class provides the toplevel interface to File::Fu directory and file objects, with operator overloading which allows precise path composition and support for most builtin methods, as well as creation of temporary files/directories, finding files, and more. The interface and style are quite different than the perl builtins or File::Spec. The syntax is concise. Errors are thrown with croak(), so you never need to check a return code. Constructors The actual objects are in the 'Dir' and 'File' sub-namespaces. dir my $dir = File::Fu->dir($path); See "new" in File::Fu::Dir file my $file = File::Fu->file($path); See "new" in File::Fu::File Class Constants tmp Your system's '/tmp/' directory (or equivalent of that.) my $dir = File::Fu->tmp; home User's $HOME directory. my $dir = File::Fu->home; program_name The absolute name of your program. This will be relative from the time File::Fu was loaded. It dies if the name is '-e'. my $prog = File::Fu->program_name; If File::Fu was loaded after a chdir and the $0 was relative, calling program_name() throws an error. (Unless you set $0 correctly before requiring File::Fu.) program_dir Returns what typically corresponds to program_name()->dirname, but just the compile-time cwd() when $0 is -e/-E. my $dir = File::Fu->program_dir; Class Methods THIS_FILE A nicer way to say __FILE__. my $file = File::Fu->THIS_FILE; cwd The current working directory. my $dir = File::Fu->cwd; which Returns File::Fu::File objects of ordered candidates for $name found in the path. my @prog = File::Fu->which($name) or die "cannot find $name"; If called in scalar context, returns a single File::Fu::File object or throws an error if no candidates were found. my $prog = File::Fu->which($name); Temporary Directories and Files These class methods call the corresponding File::Fu::Dir methods on the value of tmp(). That is, you get a temporary file/dir in the '/tmp/' directory. temp_dir my $dir = File::Fu->temp_dir; temp_file my $handle = File::Fu->temp_file; Subclassing You may wish to subclass File:Fu and override the dir_class() and/or file_class() class methods to point to your own Dir/File subclasses. my $class = 'My::FileFu'; my $dir = $class->dir("foo"); See File::Fu::File and File::Fu::Dir for more info. See Also File::Fu::why if I need to explain my motivations. Path::Class, from which many an idea was taken. File::stat, IO::File, File::Spec, File::Find, File::Temp, File::Path, File::Basename, perlfunc, perlopentut. AUTHOR
Eric Wilhelm @ <ewilhelm at cpan dot org> http://scratchcomputing.com/ BUGS
If you found this module on CPAN, please report any bugs or feature requests through the web interface at <http://rt.cpan.org>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. If you pulled this development version from my /svn/, please contact me directly. COPYRIGHT
Copyright (C) 2008 Eric L. Wilhelm, All Rights Reserved. NO WARRANTY
Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned. LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-05-13 File::Fu(3pm)
All times are GMT -4. The time now is 06:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy