Sponsored Content
Top Forums Shell Programming and Scripting Dynamic file name in variable Post 302626551 by guddu_12 on Thursday 19th of April 2012 12:04:29 PM
Old 04-19-2012
Ok Fine,

Actually the file which will be called "scripts.sh" contains sql loader control file structure.
i don't know if i can add into it anything which additional to control file information.

Can you please reply if you know this

---------- Post updated at 11:04 AM ---------- Previous update was at 10:56 AM ----------

Hi can we modify the file contain while processing and close befor next lines get execute.

my control file has below text
Code:
load data
        BADFILE /backup/temp/rajesh/BadFiles/rio.bad
        append into TEMP_rio_RESP_TIME_LND
        (
        INSTALLATION_ID          CHAR
        TERMINATED BY "," ENCLOSED BY '"',
        TRANSACTION_ID           CHAR
        TERMINATED BY "," ENCLOSED BY '"',
         file_name)

----this file name should be set every time new file is getting processed.

so the code should be

for i in /backup/logs -- it will give all the logs file
SC_RIO_RWVM_20120413064217303.LOG
SC_RIO_RWXM_20120413064225493.LOG
SC_RIO_RXXM_20120413064233273.LOG

do

open ctl file and set the file name.
open scripts.sh --- which has referenced to ctl file just set above.

Thanks for understanding

Last edited by Scrutinizer; 04-19-2012 at 01:26 PM.. Reason: some code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Dynamic Variable Declatation

Evening all, Have been trying to create the following environment variable: ${MD_SYSTEM}_ZZ_EMAIL_SUPPORT="myname@domain.com" However when the script that contains the above is executed it returns: ksh: MDQA_ZZ_EMAIL_SUPPORT=myname@domain.com: not found Is what I'm trying to do... (2 Replies)
Discussion started by: Cameron
2 Replies

2. UNIX for Dummies Questions & Answers

Dynamic variable values

Bit of a newbie :D with regard to unix scripting and need some advice. Hopefully someone can help with the following: I have a predefined set of variables as follows: AAA_IP_ADD=1.1.1.1 BBB_IP_ADD=2.2.2.2 I have a funnction call which retrieves a value into $SUPPLIER which would be... (3 Replies)
Discussion started by: ronnie_uk
3 Replies

3. Shell Programming and Scripting

Dynamic variable assignment

Hi All, I have the below scenario: A file test.cfg with three fields>> DATA1 DATA2 DATA3 In the script I need to assign each of the fields to variables. The number of fields will not be constant (this case we have three). Im trying to do something like this: NUM=1 OUT_DAT_NO=3 ... (4 Replies)
Discussion started by: deepakgang
4 Replies

4. Shell Programming and Scripting

dynamic variable name

I found one post in another site with a solution for my problem the below solution should explain what I want. #!/bin/sh first="one" second="two" third="three" myvar="first" echo ${!myvar} But this gives error 'bad substitution' System info SunOS sundev2 5.9... (3 Replies)
Discussion started by: johnbach
3 Replies

5. Shell Programming and Scripting

Help with Dynamic variable

I need some variable help TEMP1=Jane TEMP2=Sue X=1 eval USER=TEMP${X} echo $USER This gives output USER1 I would like to get Jane I have tried eval USER='TEMP${X}' eval USER="TEMP${X}" eval USER=`TEMP${X}` (3 Replies)
Discussion started by: Jotne
3 Replies

6. Shell Programming and Scripting

dynamic variable value assignmnet

QUERY IN BRIEF Listing the query in short #! /bin/csh -f #say i have invoked the script with two arguments : a1 and 2 set arg = $1 # that means arg = a1 echo "$arg" #it prints a1 #now what i want is: echo "$a1" #it will give error message :a1 undefined. #however what i need is that the... (2 Replies)
Discussion started by: animesharma
2 Replies

7. Shell Programming and Scripting

Passing dynamic variable within another variable.

I have a small program which needs to pass variable dynamically to form the name of a second variable whose value wil be passed on to a third variable. ***************** Program Start ****************** LOC1=/loc1 PAT1IN=/loc2 PAT2IN=/loc3 if ; then for fpattern in `cat... (5 Replies)
Discussion started by: Cyril Jos
5 Replies

8. Shell Programming and Scripting

Dynamic variable assignment

My Code : -------------------------------------------- #!/bin/bash for i in `echo server1 server2` do eval ${i}_name = "apache" echo ${i}_name done -------------------------------------------- Current output : >./test.sh ./test.sh: line 5: server1_name: command not found... (3 Replies)
Discussion started by: sameermohite
3 Replies

9. UNIX for Dummies Questions & Answers

Dynamic Variable creation

I am trying to create some variables based on the input by the user, say if user entered 3 then 3 variables and if 5 then 5 variables. I am using a for loop for (( i=1; i <= $num; i++ )) do x="num" x+=$i done When i am using echo $x it will show num1 but now how to create variables... (3 Replies)
Discussion started by: Raj999
3 Replies

10. Shell Programming and Scripting

Dynamic variable assignment

#!/bin/sh if then echo "Insufficient number of arguments ">> error".log" ; echo "Please check error log for more details"; exit 1 ; else file_name=$1".csv"; fi ; in_par_number=`head -n1 $file_name | sed 's///g' | wc -c` read -a arr <<< `head -n1 $file_name | sed 's// /g'` ... (6 Replies)
Discussion started by: JayDoshi
6 Replies
CONTROLCHAN(8)						      System Manager's Manual						    CONTROLCHAN(8)

NAME
controlchan - channel-fed control message handler SYNOPSIS
controlchan DESCRIPTION
Controlchan removes the responsibility for handling control messages (except cancels) from innd(8) and instead processes them from a chan- nel or file feed. To reduce load, controlchan keeps a copy of control.ctl in memory and checks permissions (including any required PGP headers) before any scripts are called. Also, the default (``bad message'') case is handled internally. The ``drop'' case is handled with far less fuss. Normally, controlchan is invoked by innd(8) as configured in newsfeeds. An example entry is below. Make sure that you've created the newsgroup control.cancel so that controlchan doesn't have to scan through cancels, which it won't process anyway. controlchan! :!*,control,control.*,!control.cancel :AC,Tc,Wnsm :<pathbin in inn.conf>/controlchan Note that in the (very, very unlikely) event that you need to process ihave/sendme control messages, be sure that logipaddr is set to false in inn.conf, because in this case controlchan needs a site name, not an IP address. Controlchan tries to report all log messages through syslog(3), unless connected to an interactive terminal. To enable syslog(3)'ing for versions of Perl prior to 5.6.0, you will need to have run ``h2ph'' on your system include files at some point (this is required to make ``Sys::Syslog'' work). If you have not done so, do this: cd /usr/include h2ph * sys/* If you run FreeBSD, you will need to run the following in addition: h2ph machine/* HISTORY
Written by Katsuhiro Kondou <kondou@nec.co.jp> for InterNetNews. This is revision 8180, dated 2008-11-21. SEE ALSO
control.ctl(5), inn.conf(5). CONTROLCHAN(8)
All times are GMT -4. The time now is 06:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy