Shell script that reads from configuration file to get database


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script that reads from configuration file to get database
# 1  
Old 04-15-2008
Shell script that reads from configuration file to get database

Hi intelligent beings,

I am trying to write a script that
1. Accepts the following arguments:
store_number
div_number
user_id
div_code

2. Will read from a configuration file to get the Database

3. Use the div_code to determine which value to retrieve from the configuration file

So far the first part of it I wrote as:

store_number=$1
div_number=$2
user_id=$3
div_code=$4

The script to write to the configuration file was written like this:

getline<"store_to_dm.cfg" -------> store_to_dm.cfg is configuration file that I also create

The statement above should be able to read from the configuration file, but how can it get the database out of it?

The third part I just need help in because I am stuck on that part. Please help!!!

Overall for the script I have:
#!/bin/sh
store_number=$1
div_number=$2
user_id=$3
div_code=$4

getline<"store_to_dm.cfg"

Thanks in advance.
# 2  
Old 04-15-2008
Quote:
Originally Posted by dolo21taf
Hi intelligent beings,

I am trying to write a script that
1. Accepts the following arguments:
store_number
div_number
user_id
div_code

2. Will read from a configuration file to get the Database

3. Use the div_code to determine which value to retrieve from the configuration file

So far the first part of it I wrote as:

store_number=$1
div_number=$2
user_id=$3
div_code=$4

The script to write to the configuration file was written like this:

getline<"store_to_dm.cfg" -------> store_to_dm.cfg is configuration file that I also create

What language are you using? There is no getline command in the shell.
Quote:
The statement above should be able to read from the configuration file, but how can it get the database out of it?

What is the format of the configuration file?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script that reads a file

I have below script to read a file line by line. How can I ensure that the loop will stop after last line. #!/bin/bash while read -r mod ver tarball; do echo $mod done < taskfile.txt (4 Replies)
Discussion started by: aderamos12
4 Replies

2. Shell Programming and Scripting

How to log file processing details to database table usnig UNIX shell script?

we are getting files on daily basis.we need to process these files. i need a unix shell script where we can count 1-The no of files processed 2-No of data/record processed for each files. The script should log these details into a database table. If there is any error while file... (3 Replies)
Discussion started by: Atul kumar
3 Replies

3. UNIX for Dummies Questions & Answers

Difference between buffered disk reads and cached reads?

I was analyzing the Disk read using hdparm utility. This is what i got as a result. # hdparm -t /dev/sda /dev/sda: Timing buffered disk reads: 108 MB in 3.04 seconds = 35.51 MB/sec # hdparm -T /dev/sda /dev/sda: Timing cached reads: 3496 MB in 1.99 seconds = 1756.56 MB/sec... (1 Reply)
Discussion started by: pinga123
1 Replies

4. Shell Programming and Scripting

script that reads all the scripts in the directory and run them within that script

Hi I am trying to write a shell script that is reading all the scripts in the current directory (currently 5) and is allowing me to run the scripts that is in the directory. I want that this scripts asks te user to execute 1 of the listed scripts. I have 4 sample scripts in the directory:... (8 Replies)
Discussion started by: I-1
8 Replies

5. Shell Programming and Scripting

passing argument to shell script that reads user inputs

Hi, Lets say I have a script "ss" which does this read abc echo $abc read pqr echo $pqr Now if I want to pass and argument to only "abc" how do I do it. If I do echo "somevalue" | ss, it does not prompt for pqr and its value comes out as blank. Any help is appreciated Thanks P (6 Replies)
Discussion started by: patjones
6 Replies

6. Shell Programming and Scripting

How to read the configuration file from shell script

Hello all, Please let me know if anyone have the idea how to read the configuration file from the shell script? Thanks in advance, Nishanth (7 Replies)
Discussion started by: nishanth hampal
7 Replies

7. Shell Programming and Scripting

Shell Script: want to insert values in database when update script runs

Hi , I am new to linux and also also to shell scripting. I have one shell script which unpacks .tgz file and install software on machine. When this script runs I want to insert id,filename,description(which will be in readme file),log(which will be in log file) and name of unpacked folder... (1 Reply)
Discussion started by: ring
1 Replies

8. Shell Programming and Scripting

Need Shell Script to upload data from Text file to Oracle database

Hi Does any one have any idea on uploading the data using Unix Shell script from text file to Oracle database. Requirement:- 1. Need to connect to Oracle database from Unix Shell script. 2. Need to pick Text file from some location on Unix Box. 3. Need to upload the data from text file to... (6 Replies)
Discussion started by: chandrashekharj
6 Replies

9. Shell Programming and Scripting

sh script that reads/writes based upon contents of a file

Hi everyone, Ive got a quick question about the feasibility and any suggestions for a shell script. I can use sh or ksh, doesnt matter. Basically, Ive got an output file from a db2 command that looks like so: SCHEMA NAME CARD LEAF ELEAF LVLS ISIZE NDEL KEYS F4 F5 ... (3 Replies)
Discussion started by: rdudejr
3 Replies

10. 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
Login or Register to Ask a Question