Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Off topic: Unix Script Help Needed

Re: Off topic: Unix Script Help Needed

From: Srinivas Rao Pulla <spulla_at_deploy.com>
Date: Mon, 15 Jan 2001 20:00:10 -0800
Message-Id: <10742.126727@fatcity.com>


Hi Siva,

 There can be may ways of doing it, but here is a simple way to do that, give a try with this or tweak around to make it work.

#!/bin/sh
# Execute first to pick up every entry in master.conf, the second loop will take every entry from #master.conf and loops till end and assigns the name and value to the NAME and VALUE, # call_other_program can be passed with NAME and VALUE as arguments to the rest.
for i in ` cat master.conf`
do
for j in ` cat $ i`
do
NAME=`echo $j | cut -d "=" -f 1`
VALUE=` echo $j | cut -d "=" -f 2`
call_other_program $NAME $VALUE
done
done

Thanks
Srinivas

"Valiveru, Siva" wrote:

> All,
> I need help in writing a Unix shell script , here is our requirement, my
> script looks for master config file say, master.conf having values of the
> pattern 'filename' and reads all the entries till end of file,
> for each entry in the master.conf there will be o/s file in the same
> directory and my script looks for the all the configuration values having
> the simple pattern name=value in that file,
> based on the name and value I am doing some processing. Can somebody there
> provide me a direction to how to achieve this,
>
> logic flow is as follows,
>
> myscript.sh
>
> 1) Read master.conf file
> 2) look for each detail config file for each entry in master.file, error out
> if detail config file is missing and loops for end of file.
> 3) Read each line of the individual file till end of file and take 'name'
> into $NAME variable and 'value' to $VALUE variable, call another script with
> these values as input to that script.
>
> contents of master.conf
>
> file1.conf
> file2.conf
>
> contents of file1.conf
>
> variable1=10
> variable2=20
>
> content of file2.conf
>
> variable3=30
> variable4=40
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Valiveru, Siva
> INET: SValiveru_at_ea.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
Received on Mon Jan 15 2001 - 22:00:10 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US