Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Unix question
<SPAN
class=948131115-26032001>The UNIX command "sed", "awk", and "tr" offer a world
of solutions for altering text.
<SPAN
class=948131115-26032001>
<SPAN
class=948131115-26032001>Using Ksh93 you can do substringing. You can find
it on Aix, and Sun system in the form of "dtksh". The syntax
is:
<SPAN
class=948131115-26032001>
<SPAN
class=948131115-26032001>
#!/usr/dt/bin/dtksh
<SPAN
class=948131115-26032001> ...cut...
<SPAN
class=948131115-26032001>
myvar=${myvarin:startpos:length}
<SPAN
class=948131115-26032001> ...rest...
<SPAN
class=948131115-26032001>
<SPAN
class=948131115-26032001>To edit a file on the fly use the old "edit"
command. An example follows:
<SPAN
class=948131115-26032001>
<SPAN
class=948131115-26032001> 3925:oratst_at_marge> cat
/tmp/abc
aaaaaaaaaaaabbbbbbbbbbbbbbbbbccccccccccccccc$HOSTNAME$.$SCHEMA$
111111111111122222222222222222233333333333333925:oratst_at_marge>
> q > EOF "/tmp/abc" 3 lines, 110 characters MYBOX.$SCHEMA$ MYBOX.MYSCHEMA "/tmp/abc" 3 lines, 105characters 3925:oratst_at_marge>
aaaaaaaaaaaabbbbbbbbbbbbbbbbbcccccccccccccccMYBOX.MYSCHEMA
111111111111122222222222222222233333333333333925:oratst_at_marge>
<FONT face=Tahoma
size=2>-----Original Message-----From: Big Planet
[mailto:bigplanet34_at_hotmail.com]Sent: Friday, March 23, 2001 6:56
PMTo: Multiple recipients of list ORACLE-LSubject: Unix
question
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
Received on Mon Mar 26 2001 - 09:45:00 CST
![]() |
![]() |