0

Hi
sed -f /opt/DBACheck.sql.sed /opt/DBACheck.sql > /opt/DBACheck.sql.tmp
mv -f $DBACheck.sql.tmp $DBACheck.sql

where the contents of DBACheck.sql.sed is

{
s%${DBMS_USER}%SYSTEM%g
}
DBACheck.sql is a one line file , that contains line with string DBMS_USER which i want to replace it with SYSTEM.
But on executing i get DBACheck.sql to be an empty file with all its contents erased .

DBACheck.sql -
select granted_role from sys.dba_role_privs where grantee='${DBMS_USER}';

Thanks
Shyamala

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by shyamalaa
0

That's really odd... It works OK on my system:

$ sed -f DBACheck.sql.sed DBACheck.sql
select granted_role from sys.dba_role_privs where grantee='SYSTEM';

What version of sed are you using? ( sed --version )

-G

0

Thanks for the reply gromit .
It finally worked :)
After appending an empty line in DBACheck.sql -
select granted_role from sys.dba_role_privs where grantee='${DBMS_USER}';

I was able to get the desired output

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.