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
 
 
 
----- Original Message -----
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 ,How can I do substr and instr kind of operaion in unix shell script . is it possible ?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 .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. TIA--Big planet  

Reply via email to