taking every variable and executing the command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting taking every variable and executing the command
# 1  
Old 08-24-2005
taking every variable and executing the command

Hi,
I am trying to export some 50 tables and i want to write a loop and execute the script for every table. I did for one table and its running. Can any one help me for setting a loop and running the script for all the tables
thanks
# 2  
Old 08-24-2005
How about a few details here? System? OS? Language? Database? Also post the script you have for the one table.
# 3  
Old 08-24-2005
Quote:
Originally Posted by Perderabo
How about a few details here? System? OS? Language? Database? Also post the script you have for the one table.

Its oracle Database and os is linux I want it to do it in shell
here is what i did

#!/usr/bin/sh
dumptime=`date '+%Y %m %d:%H:%M:%S' | sed -e 's/ //g' `
user=username
password=password
tables=(table1)
exp $user/$password buffer=2000000 file=$user.qwer.dmP.$dumptime log=qwer.log.$dumptime tables=$tables compress=N direct=Y grants=N consistent=Y statistics=NONE

I can write a query to display all the tables in to a file . I want to take every single table from the file and do the export the schema
# 4  
Old 08-24-2005
After you spool the list of tables to a file called tables.lst in the current directory, this will loop through the list one at a time:
Code:
#!/usr/bin/sh
dumptime=`date '+%Y %m %d:%H:%M:%S' | sed -e 's/ //g' `
user=username
password=password

for table in `cat tables.lst`
   do exp $user/$password buffer=2000000 file=$user.qwer.dmP.$dumptime log=qwer.log.$dumptime tables=$table compress=N direct=Y grants=N consistent=Y statistics=NONE

done

Or this will build a list of tables

Code:
#!/usr/bin/sh
dumptime=`date '+%Y %m %d:%H:%M:%S' | sed -e 's/ //g' `
user=username
password=password

tables=`cat tables.lst | tr  \\n " "`
tables=\(${tables}\)

exp $user/$password buffer=2000000 file=$user.qwer.dmP.$dumptime log=qwer.log.$dumptime tables=$tables compress=N direct=Y grants=N consistent=Y statistics=NONE


Last edited by 98_1LE; 08-24-2005 at 10:08 PM..
# 5  
Old 08-24-2005
thankyou very much. Can you please guide me where should i put the tables.lst file which contains all the list of tables.
thanks
# 6  
Old 08-24-2005
/tmp should be fine
# 7  
Old 08-25-2005
thanks its working perfectly Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed not taking variable value

Hi All, Could you please help me, why sed is not able to take variable value when I try to replace using sed. I want to replace 2nd column (time) and keeping intact others. cur="09:30" CODE="VL" new="09:35" sed s/'\(.*def.monitor."${CODE}".qStart.*\)"${cur}"\(.*read\)/\1"${new}"\2'/g... (3 Replies)
Discussion started by: sdosanjh
3 Replies

2. Shell Programming and Scripting

Help with taking variable of for loop in textfile

Hi, I am new to unix/linux scripting. I have a text file, listlib.txt where the content: lib1_23 lib34_a ab_li_lab I need to generate a file (.log) of each cell. I am planning to create a (.csh) script that will have for loop with variable taken from listlib.txt. As for now, i have no... (4 Replies)
Discussion started by: mmaz
4 Replies

3. Shell Programming and Scripting

awk command line arguments not taking

# more minusf.awk #!/bin/awk -f BEGIN { FS=":"; } { if ( $2 == "" ) { print $1 ": no password!"; } } # ./minusf.awk aa aa aa aa awk: can't open aa (6 Replies)
Discussion started by: sri.phani
6 Replies

4. Red Hat

Du -sh command taking time to calculate the big size files

Hi , My linux server is taking more time to calculate big size from long time. * i am accessing server through ssh * commands # - du -sh * #du -sh * | sort -n | grep G Please guide me for fast way to find big size directories under to / partition Thanks (8 Replies)
Discussion started by: Nats
8 Replies

5. Linux

Error executing a variable

greetings, i'll try to keep this simple... i have a script that sets up my environment and creates a command line variable to execute. when i execute the variable i get an error telling me it cannot open one of the files on the command line. the error prints a file name that is definitely... (7 Replies)
Discussion started by: crimso
7 Replies

6. UNIX for Dummies Questions & Answers

taking the output of awk command to a new file

cat doc | nawk -v da="${date}" '$23>199 {print $0 > "doc"+da+".txt"}' Every time(need to run every day) i run this, i want to a create a new file "doc_01 Aug.txt". Basically, i want to create a new file with date appended in it. The above command is creating a file with name "0".... (4 Replies)
Discussion started by: vagar11
4 Replies

7. UNIX for Advanced & Expert Users

command taking lot of time to execute

Hi, I am running the following command, and it tries to delete some dn from ldap, however, it takes lot of time before it finally request LDAP server to delete it. I am trying to find why it is taking lot of time. Could you anyone help me in this regard. I have copies the pstack output, and... (3 Replies)
Discussion started by: john_prince
3 Replies

8. Shell Programming and Scripting

Executing a variable that strores a unix command string

Hi: I have a touble with executing a variable that stores a unix command string. The following would be excuted fine: command='ls -l' `echo $command` However, the following gives me an error: command='(uuencode file1 file1; uuencode file2 file2) | mailx email_id' `echo... (1 Reply)
Discussion started by: sagewise
1 Replies

9. Shell Programming and Scripting

executing a variable assignment in a string

I'm using whatever the scripting is in this copy of busybox ! So not the full boxed set sometimes. If I do cmd="echo fred" $cmd the system prints "fred" if I do cmd="fred=9" $cmd it barfs. Is there a simple way to put a varabble assignment in a string and execute it? ... (2 Replies)
Discussion started by: dexdyne
2 Replies

10. Shell Programming and Scripting

Taking sed result in a variable

Hi All, How can i take the following code having three seds into a variable : echo "$DateFileFormat" | sed 's/\./\\\\./g' | sed 's/\$/+/g' | sed 's/\#/'$job_date'/g' I want to get the result stored in a script variable i tried var2=`echo "$DateFileFormat" | sed 's/\./\\\\./g' |... (4 Replies)
Discussion started by: abhinav192
4 Replies
Login or Register to Ask a Question