Results 1 to 3 of 3
Hi Everybody,
I am having some issues with one of my shell script, I
will explaing the whole issue.
In my script I am declaring a variable as shown below
...
- 11-30-2007 #1Just Joined!
- Join Date
- Oct 2007
- Posts
- 14
Find and replace command
Hi Everybody,
I am having some issues with one of my shell script, I
will explaing the whole issue.
In my script I am declaring a variable as shown below
var=`cat
/home/DTEDIT/new_build/"$1"/inst/data/postgresql.conf
|grep "port =" | awk -F " " '{ print $3;}'`
Now what I am doing with this command is checking for
the postgresql.conf file for the existance of port =,
it gives me a value say for example 5999, now this
5999 is stored in var...
The major issue starts from here, this variable var I
want to subsititue into another file called
postgres.properties file at the location where it says
localhost:5678, I want to replace that 5678 by the
variable var, I want to change that from 5678 to 5999.
Please tell me if there is any find and replace command
that I can call through my shell script.
Please suggest any solution.
Thanks in advance
Regards
Cinu
- 11-30-2007 #2Just Joined!
- Join Date
- Nov 2007
- Location
- Salt Lake City, UT, USA
- Posts
- 32
This is happening in another thread right now too:
Something like this? http://www.student.northpark.edu/pem...d/sed1line.txt .Code:sed 's/5678/5999/g' or....? sed 's/5678/$1/g'
- 12-10-2007 #3Just Joined!
- Join Date
- Oct 2007
- Posts
- 14
Thanks a lot,
I was able to get the solution with teh sed command


Reply With Quote