check if string exists in file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

check if string exists in file

Roshan
Hi Erman,

Red Hat Linux 6

I have a shell script which executes an import dump. At the end of the import, I want to set the current date to a variable(IMPORTGAIAGCICIFLAG) in a file called application.properties.

now=$(date)

sed 's/^IMPORTGAIAGCICIFLAG.*/IMPORTGAIAGCICIFLAG='"$now"'/g'  /home/oracle/application.properties

The issue is that the variable IMPORTGAIAGCICIFLAG in application.properties does not get updated.

Can you please guide me.

Thanks,

Roshan
Reply | Threaded
Open this post in threaded view
|

Re: check if string exists in file

ErmanArslansOracleBlog
Administrator
use "i" argument.

 -i[SUFFIX], --in-place[=SUFFIX]

              edit files in place (makes backup if extension supplied)


Ex: sed -i 's/^IMPORTGAIAGCICIFLAG.*/IMPORTGAIAGCICIFLAG='"$now"'/g'  /home/oracle/application.properties
Reply | Threaded
Open this post in threaded view
|

Re: check if string exists in file

Roshan
Thanks Erman. It is ok now