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: Unix question

Re: Unix question

From: Big Planet <bigplanet34_at_hotmail.com>
Date: Fri, 23 Mar 2001 20:31:34 -0800
Message-ID: <F001.002D6FCE.20010323194036@fatcity.com>

No No . Here is full problem
 

I have this ini file called xyz.ini having

 

hostname = $HOSTNAME$.acme.com
schemaname=$SCHEMANAME$
domainname= $HOSTNAME$.foo.bar.com
 

okay , Now I am getting the values of hosname as "abc" , schema name as "schem" .
I want to write a script in which I will pass these parameters and they will do a search and replace kindof operation. I was thinking of using sed , but how to get rid of quotes because my $1 is "abc" so after replacement file will become
 

hostname = "abc".acme.com
schemaname="schem"
domainname= "abc".foo.bar.com
 

while I want it to be like
 
 

hostname = abc.acme.com
schemaname=schem
domainname= abc.foo.bar.com
 

- Big Planet
 
 
 

<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">

  To: <A href="mailto:ORACLE-L_at_fatcity.com"   title=ORACLE-L_at_fatcity.com>Multiple recipients of list ORACLE-L   Sent: Friday, March 23, 2001 8:45
PM
  Subject: Re: Unix question
  Yes & no.
  There are a couple of different way to solve the problem. 1) Write your   own functions/filters to accomplish the desired operations 2) If the only   place in the file where double quote marks exists are around the hostname       and all you want to do is get rid of them, the "tr"   command could be used. 3) Unix scripts can accept command line arguments   which are positionally dependant so you could create a master script which   would look like the following driver.sh host1 schemaA driver.sh host2

  schemaB driver.sh host9 schemaG etc....................... 
  The inside driver.sh where you want the hostname to appear place a $1   The inside driver.sh where you want the schema    to appear   place a $2
  HTH & YMMV!
  Big Planet wrote:        

    Hi geeks ,<FONT
    face=Arial>How can I do substr and instr kind of operaion in     unix shell script . is it possible ?<FONT     size=-1>like i have one paramter as "hostname" .. I want to trim quotes     surrounding the hostname .One
    more question , is possible to read another text file line by line using a     shel script and then edit that file .<FONT     size=-1>Actually I have this configuration file for my system which have     keywords like $HOSTNAME$ , $SCHEMA$ which I want to replace with actual     values at the time of installation by asking questions to the     user. <FONT
    size=-1>TIA--Big
    planet   Received on Fri Mar 23 2001 - 22:31:34 CST

Original text of this message

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