Sed problem in a Bash script

Posted by moata_u on Ask Ubuntu See other posts from Ask Ubuntu or by moata_u
Published on 2011-03-03T07:29:51Z Indexed on 2011/03/03 15:33 UTC
Read the original article Hit count: 603

Filed under:
|
|

Hello there.

I'm having a problem using the sed command . I'm trying to write a bash script that does the following :

  1. search for the line that contain :@
  2. then save the line that contained :@ and replace it with new line

as in the following:

#! /bin/bash

echo "Please enter the ip address of you file"<br>
read ipnumber<br>
find=`grep ':@' application.properties` # find the line<br>
input="connection.url=jdbc\racle\:thin\:@$ipnumber\:1521\:billz" # preparing new line<br>
echo `sed "s/'${find}'/'${input}'/g" application.properties` # replace old with new line <br>

The problem is: nothing happens.

I've already tried to use "${find}" instead of '${find}'

© Ask Ubuntu or respective owner

Related posts about command-line

Related posts about bash