943,758 Members | Top Members by Rank

Ad:
May 5th, 2009
0

sed -f clears the file

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shyamalaa is offline Offline
6 posts
since Aug 2007
May 5th, 2009
0

Re: sed -f clears the file

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
Reputation Points: 46
Solved Threads: 28
Junior Poster
Gromit is offline Offline
183 posts
since Sep 2008
May 6th, 2009
0

Re: sed -f clears the file

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shyamalaa is offline Offline
6 posts
since Aug 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: You could have done it better, but how?
Next Thread in Shell Scripting Forum Timeline: share up the automatic executor for visual studio cs. net command prompt





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC