Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi guysthis my sample file sample.ksh
DBUID=testdatabase
DBLOC=wm4r2i want replace DBUID=testdatabase by DBUID=$myvariable (i.e myvariable=arundatabase). the name testdabase is not fixed and it changes from time to time. so my search criteria is DBUID. after replacing the line i need to save it in same file
thus finally i want my sample.ksh file as
DBUID=arundatabase
DBLOC=wms4r2this is how i want u to help u.. read the line from a file and replace it from mychoice data and save it back to the same file without altering the other contents.
i m looking forward to your help.. get me the solution as soon as possible
thanks
Arun

#/bin/ksh
myvariable=arundatabase
sed "s/DBUID=.*/DBUID=$myvariable/" sample.ksh >/tmp/sample.ksh
mv /tmp/sample.ksh .it's ok.

![]() |
Unix replacing text
|
output of a cmd>replace a...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |