Thanks PHV and feherke.
PHV: Sorry, maybe the example was not clear enough. The no of tables I have is about 70, and to type in every char in lower and upper for ever table would be a pain.
feherke: Yes that does the trick. But for a certain entry in replace_tab_names.txt the substitution...
Hi ,
We have a standard Solaris installation so no "i" option for case insensitive sed.
I have a lot of oracle views in which I need to replace the table names with different tablenames. There is one script per view.
So the set of oracle scripts is like V_123.sql , V_ABC.sql , V_DEF.sql...
Hi,
Is there a way to strip off the last few characters of a string. ( In my example, I need to stroip the last 4 characters)
So the example input strings are
2276680000EUR201020971
2338810000EUR201021861
And the output I need is
2276680000EUR20102
2338810000EUR20102
I couldnt see any...
Hi
I have a file which has things like
CREATE TABLE ....
...
;
;
CREATE TABLE ...
;
CREATE TABLE ...
; ;
CREATE TABLE ...
/
CREATE TABLE ...
/
;
I need to find out the occurances of semi colon followed by nothing then a semicolon.
Is there a way to do it in some kind of a awk...
Hey PHV. That works. Thanks.
Sorry feherke. It works on the small set of test script posted above, but not on the original huge SQL file.
I had constructed the test file by copying the text I need to look for(CREATE OR REPLACE VIEW), from the huge SQL file. So it is not the case mismatch. It...
Thanks for the response feherke.
But if I dont reset the var after every print then I will get back all the occurances. Whereas I am only after 1st, 3rd, etc. So I am saying
Is the var !set and is the statement CREATE OR REPLACE
if yes print the line and set the var.
So for the next...
Hi ,
I have a SQL file with a set of CREATE OR REPALCE statements. There are always two sets for every object created. I need the first occurance of each of these statements...
Like for example...
#my_orig_file.sql
CREATE OR REPLACE view test1
as select sysdate from dual;
CREATE OR REPLACE...
Hi,
I need to do something like
for i `ls -1 *.sql `
do
for k in `grep "MY TEXT" $j `
do
..
...
..
done
done
And one of the sql files may contain lines like
MY TEXT ABC
fkjgnhdfg
MY TEXT PQR
dfkljgn
MY TEXT XYZ
So a grep would return three lines and I want to work on the three...
I have a text file with which, besides other things contains lines like
ADD CONSTRAINT ADRA_UK UNIQUE (ADRA_ADRA_ADRACD, ADRA_MND_MNDCD)
...
...
ADD CONSTRAINT ADR_ADRA_FK FOREIGN KEY (ADR_ADRA_AACD, ADR_MND_MNDCD)
...
...
CREATE INDEX ADR_ADRA_FK
ON ADRESSE$ (ADR_ADRA_AACD...
I have hit a snag. I cannot look for TEST_OLD_FK
but need to look for
DROP CONSTRAINT *_OLD_FK, where * can be anything. I mean it could be AAA_OLD_FK or BBBBBB_OLD_FK or CC_OLD_FK. I tried using a * or even a regex like [A-Z]* but that didnt work. What am I doing wrong.
That does the trick, though I have used the second code with the gsub.
A question on the first code: I thougth NF was for number of fields in a record, but you seem to be matching a text. I guess you can use it only if the text is the last word ( as you said).
Many Thanks.
Thanks Feherke, but I get the error on both the pieces of code.
awk: syntax error near line 1
awk: bailing out near line 1
Is there a way of debugging...When I got the errors I tried to use nawk instead of awk. But no luck there.
Hi ,
I have a huge file with a lot of oracle statements. In there is there a way to do the following
When I come across the text "_OLD_FK" like below lines
ALTER TABLE TEST$AB DROP CONSTRAINT TEST_OLD_FK
/
I need to add another set of lines with the _OLD_FK replaced with _NEW_FK
so the...
I have used nawk and that did the trick. Thanks a lot. Now please can you explain what the script is doing.
I understand the general principle which is to look for the text insert and to make it case insensitive you have added the tolower. Print /* and then keep looking for the next commit...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.