How to read the configuration file from shell script

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to read the configuration file from shell script
# 1  
Old 01-29-2008
Data 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,
# 2  
Old 01-29-2008
Please provide a sample input (config) file and expected output..
# 3  
Old 01-29-2008
The config file looks like below:

# This is the properties file which has the Hostaddress,instancecount,username and the password

USERNAME = pwdfre,kjhy
PASSWORD = hgfre,loiuy

The individual entries i have to store in an array and then do operations on that.
# 4  
Old 01-29-2008
Try this,
sed -e '1i#!/bin/ksh' -e 's/,/ /g' -e 's/=//g' -e 's/\(.*\)/set -A \1/' /tmp/yourInput > /tmp/array_config.ksh

The above will create a ksh script with arrays.

You can use them,to list all the values contained in the array use ${HOST_ADDRESS[*]} format

Nagarajan G
# 5  
Old 01-29-2008
Retrieve files thru sftp

Can anyone help me out how to retrieve set of *.log files from a directory using shell script?
# 6  
Old 01-29-2008
for file in /your/dir/*.log ; do
 echo "Your processing goes here"

Nagarajan G
# 7  
Old 01-29-2008
how to store key value pairs(hash)in shell scripting

Please let me know how to store key value pairs and sort the keys of hash in shell scripting.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

2. Shell Programming and Scripting

Read parameter file for a shell script

Hi All, I need urgent Help from all of you here. Below is my code- ================================================== #!/usr/bin/sh cd $1 cat $2 | tr -ds "$" "" > parameter_file.param export `parameter_file.param` chmod 777 parameter_file.param echo $1 echo $2 cd $prmDirInput... (5 Replies)
Discussion started by: Amit786
5 Replies

3. Shell Programming and Scripting

How to read a file through shell script?

hi all, i have to read a file using shell script for example my csv file is like this Tid Inputfille Inputfilepath 1 ABC_20141218.idr /export/home/him60t1/input 2 ABC_20141219.idr /export/home/him60t1/input1 what i have to do is if on my command line i... (1 Reply)
Discussion started by: ramsavi
1 Replies

4. Red Hat

How to read an xml file through shell script?

Hey , can we read an xml file and make changes in it through shell script. Thanks (4 Replies)
Discussion started by: ramsavi
4 Replies

5. UNIX for Dummies Questions & Answers

Read excel file using shell script

Is it possible to read an excel sheet using shell script ? (2 Replies)
Discussion started by: hiten.r.chauhan
2 Replies

6. Shell Programming and Scripting

need shell script to read particular records from a file

i am reading an i/p file input.txt as below and want to read all filenames as in highlighted in bold below and put them in a different file output.txt. can someone help me with a shell script to do this? thanks in advance regards brad input.txt --------- START TYPE:OPT INIT_SEQ:01... (8 Replies)
Discussion started by: bradc
8 Replies

7. Shell Programming and Scripting

how to read dbf file in shell script and to convert dbf file usinf shell script

Hi all, I am new to shell scripting. I have dbf file and I need to convert it into csv file. OR, can i read the fields from a .dbf file and OR seprate the records in dbf file and put into .csv or txt. Actually in the .dbf files I am getting , the numbers of fields may vary in very record and... (6 Replies)
Discussion started by: gauara
6 Replies

8. 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

9. Shell Programming and Scripting

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 ... (1 Reply)
Discussion started by: dolo21taf
1 Replies

10. Shell Programming and Scripting

script to read configuration file

Hi, I would like to write a Korn shell script which will remove files older than a certain date. In my script, it will read a configuration file with the following entries: # <directory> <filename wildcard> # /home/philip/log *.log /home/philip/log1 delete-me*.log The... (1 Reply)
Discussion started by: philip_dba
1 Replies
Login or Register to Ask a Question