The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
shell script to remove old files and write to a log file yabai Shell Programming and Scripting 4 12-09-2008 01:08 PM
Executing Multiple .SQL Files from Single Shell Script file anushilrai Shell Programming and Scripting 3 04-07-2008 11:09 AM
Shell Script: want to insert values in database when update script runs ring Shell Programming and Scripting 1 10-25-2007 04:06 AM
shell script comparing files in a file raina_nalin Shell Programming and Scripting 4 06-21-2005 07:00 AM
update a oracle table using shell script ann_124 Shell Programming and Scripting 2 12-18-2004 07:24 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-15-2008
dba_nh dba_nh is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 1
Help shell script to loop through files update ctl file to be sql loaded

I am currently trying to find a way to loop through files in a given directory and for each file modify a ctl file and sql load it. I have been using the sed command to change the infile, badfile parameters of the control file. I have not yet tried to sql load it.
Requirement: files are ftp to directory. Shell loops through the files and then using a master control file change the infile, badfile parameters with the file name. SQL load file.

I currently have been trying the following.
<<filename>> is what I am using to change in the ctl file.

export MY_DIR=/volume/files

for a in $MY_DIR/*ctl
do
sed -e "s/<<filename>>/$a/g" $a $a.ctl
done

I am wondering if their is a way to reference the infile, badfile directly in the ctl file instead. I also have an insert into a table where the filename that I am loading needs to be inserted. My method leaves me with a badfile with "name.ctl.bad" instead of just "name.bad". I am new to shell scripting so please be nice.

Thanks in advance.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0