Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have a lot of Oracle DB package bodies in files and need to replace the names of internal called procedures/functions.
A small example:
suppose we want to change InsertCustomer to InsCust in a procedure like this:
PROCEDURE InsertCustomers () AS
SELECT InsertCustomer() FROM DUAL; -- this should be replaced
SELECT someOtherPackage.InsertCustomer() FROM DUAL -- this not
I need a restriction for sed, which excludes the lines 1,5 and 6 but in case insensitive mode (END can also be end or End, ...). There's an option /i in sed for the case insensitive mode, but that only applies for replacement and not for the restriction pattern.
I use following command, but that excludes only lines with PROCEDURE, FUNCTION, END in upper case and 'anything.InsertCustomer':
sed '/^\(PROCEDURE\|FUNCTION\|END\|.*\+\.InsertCustomer\)/ !s/InsertCustomer/InsCust/i'
I also need to have the ability to exclude lines like this:
According to this, gnu sed has an 'I' flag for case-insensitivity that can be used after regex expressions. I've tried a couple of simple tests and it seems to work both in the matching and in the replacement expressions.