Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Creating script to read many files and load into database via single control file Post 303042120 by Chubler_XL on Sunday 15th of December 2019 07:20:54 PM
Old 12-15-2019
Rather than using sed to change your original template file and then change it back why not create a new file with the changes and remove once you are done. Here I use $$ which expands to shells processID to ensure unique filename in case script is run simultaneously.

Also assuming TEXT is supposed to be replaced with the table names:

Code:
for table in switch billing
do
   for file in /tmp/*.$table 
   do
       if [ -f "$file" ] 
       then
           sed -e "s|FILENAME|$i|g" -e "s|TEXT|$table|g" /tmp/data1.ctl  > /tmp/$$_data1.ctl
           sqlldr TNS control=/tmp/$$_data1.ctl
           rm /tmp/$$_data1.ctl
       fi
    done
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script to Load data into the database using a .csv file and .ctl file

Since i'm new to scripting i'm findind it difficult to code a script. The script has to be an executable with 2 paramters passed to it.The Parameters are 1. The Control file name(.ctl file) 2. The Data file name(.csv file) Does anybody have an idea about it? :confused: (3 Replies)
Discussion started by: Csmani
3 Replies

2. Shell Programming and Scripting

shell script to read data from text file and to load it into a table in TOAD

Hi....can you guys help me out in this script?? Below is a portion text file and it contains these: GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001 GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001 GEF001 000093625 MKL005675 000001... (1 Reply)
Discussion started by: pallavishetty
1 Replies

3. Shell Programming and Scripting

Need shell script to read two file at same time and print out in single file

Need shell script to read two file at same time and print output in single file Example I have two files 1) file1.txt 2) file2.txt File1.txt contains Aaa Bbb Ccc Ddd Eee Fff File2.txt contains Zzz Yyy Xxx (10 Replies)
Discussion started by: sreedhargouda
10 Replies

4. Shell Programming and Scripting

awk: creating a fixed-width single file from 2 different files

I have to create a single file from three files, Please see below for samples: day.txt 20090101 20090102 item.txt 123456789101 12345678910209 1234567891 str.txt 1 12 123 output.txt 20090101123456789101 1 0 2009010112345678910209 12 ... (2 Replies)
Discussion started by: tamahomekarasu
2 Replies

5. Shell Programming and Scripting

Creating a control file for a group of files

Hi, We have almost 45,000 data files created by a script daily. The file names are of format-ODS.POS.<pharmacyid>.<table name>.<timestamp>.dat. There will be one data file like this for each pharmacy and each table.(Totally around 45,000) The requirement is to create a control file for each... (2 Replies)
Discussion started by: Maya_Pillai
2 Replies

6. Shell Programming and Scripting

why do we need UNIX shell script to load data into Oracle database

Hello everyone, I am new to shell scripting/ loading data into a database. I want to load data into Oracle database using SQL loader. Can some one please explain why do we need unix shell script to load the data into the database? Also can someone please explain what has to be in that script?... (5 Replies)
Discussion started by: new_prog
5 Replies

7. Shell Programming and Scripting

How to read file and load data into a script as variable

I need to read a text file that contain columns of data, i need to read 1st column as a function to call, and others are the data i need to get into a ksh script. I am quite new to ksh scripting, i am not very sure how to read each row line by line and the data in each columns of that line, set... (3 Replies)
Discussion started by: gavin_L
3 Replies

8. UNIX for Advanced & Expert Users

Load a file from UNIX into database

Hi, I want your help to see if there is a way wherein we can load a set of files which are lying in unix server into my database using sql loader. Also the person who will be running sql loader does not have access to unix system. So is there a way i can provide any sql loader script wherein... (1 Reply)
Discussion started by: Vivekit82
1 Replies

9. UNIX for Beginners Questions & Answers

Generic script to load file details(ls -ltr) in to a database.

All, I am trying to create a report on the duration of an ETL load from the file arrival to the final dump in to a database for SLA's. Does anyone have any guidance or ideas on how metadata can be extracted; information of a file: like file name, created timestamp, count of records and load... (1 Reply)
Discussion started by: pradeepp
1 Replies

10. UNIX for Beginners Questions & Answers

Script for creating Control file in UNIX

Delete ---- Original post, restored by mod after being deleted by abhilashnair ---- I have a requirement where, I need to create a control file which will have 3 columns in the header row as below: Filename Count Checksum This above control file has to contain metadata as above... (2 Replies)
Discussion started by: abhilashnair
2 Replies
VDE_PLUG(1)						      General Commands Manual						       VDE_PLUG(1)

NAME
vde_plug - Virtual Distributed Ethernet plug (two plugs creates a vde cable) SYNOPSIS
vde_plug [ -p portnum ] [ -g group ] [ -m octal-mode ] [ socketdir ] DESCRIPTION
A vde_plug is a plug to be connected into a VDE switch. All the data that is catched by the plug is written in its stdout and everything from stdin is injected in the switch. This tool has been designed to be used together with dpipe (1) to interconnect a second vde_plug to another switch, working as a virtual ethernet crossed cable between the two switches. The command dpipe vde_plug = vde_plug /tmp/vde2.ctl connects two local switches: the former is using the standard control socket /tmp/vde.ctl while the latter is using /tmp/vde2.ctl. The command dpipe vde_plug = ssh remote.machine.org vde_plug connects two remote switches. If the two vde_switches run as daemon and they are connected to tap interfaces a level 2 encrypted tunnel is established. vde_plug can also be established as a login shell for users. The following command works as in the previous example dpipe vde_plug = ssh vdeuser@remote.machine.org vde_plug where vdeuser is the user with vde_plug as standard shell. All the remote accesses are logged by syslog at the beginning and at the end of each session. Attempt to login without the command vde_plug at the end or trying to execute something else are blocked and the attempt is logged into syslog. OPTIONS
-p portnum It is possible to decide which port of the switch to use. When this option is not specified the switch assigns the first available unused port (if any). It is possible to connect several cables in the same switch port: in this way all this cables work concur- rently. It means that packet can result as duplicate but no ARP table loops are generated. Is useful when vde is used for mobil- ity. Several physical interfaces can be used at a time during handoffs to prevent hichups in connectivity. -g group group ownership of the communication socket. For security when more want to share a switch it is better to use a unix group to own the comm sockets so that the network traffic cannot be sniffed. -m octal-mode octal chmod like permissions for the comm sockets socketdir (This option can be also set as: -sock socketdir ) specify the directory which contains the UNIX socket to be used by local programs for joining the VDE. The default value is "/tmp/vde.ctl", which corresponds to the socket "/tmp/vde.ctl/ctl" (or /var/run/vde.ctl when the vde_switch runs as a shared daemon). It is possible for users to redefine their default switch as ".vde-2/stdsock" in their home directory. If exist, this directory (or symbolic link to the actual directory) is used as the default value for the user. NOTICE
Virtual Distributed Ethernet is not related in any way with www.vde.com ("Verband der Elektrotechnik, Elektronik und Informationstechnik" i.e. the German "Association for Electrical, Electronic & Information Technologies"). SEE ALSO
vde_switch(1), vde_plug2tap(1), vdeq(1), dpipe(1). AUTHOR
VDE is a project by Renzo Davoli <renzo@cs.unibo.it> Virtual Distributed Ethernet December 6, 2006 VDE_PLUG(1)
All times are GMT -4. The time now is 10:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy