![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 10:09 AM |
| Shell Script: want to insert values in database when update script runs | ring | Shell Programming and Scripting | 1 | 10-25-2007 03:06 AM |
| shell script comparing files in a file | raina_nalin | Shell Programming and Scripting | 4 | 06-21-2005 06:00 AM |
| update a oracle table using shell script | ann_124 | Shell Programming and Scripting | 2 | 12-18-2004 07:24 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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. |