sed -f clears the file

Thread Solved

Join Date: Aug 2007
Posts: 6
Reputation: shyamalaa is an unknown quantity at this point 
Solved Threads: 0
shyamalaa shyamalaa is offline Offline
Newbie Poster

sed -f clears the file

 
0
  #1
May 5th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 61
Reputation: Gromit is an unknown quantity at this point 
Solved Threads: 7
Gromit's Avatar
Gromit Gromit is offline Offline
Junior Poster in Training

Re: sed -f clears the file

 
0
  #2
May 5th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 6
Reputation: shyamalaa is an unknown quantity at this point 
Solved Threads: 0
shyamalaa shyamalaa is offline Offline
Newbie Poster

Re: sed -f clears the file

 
0
  #3
May 6th, 2009
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
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC