Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. IMAUser

    Case insensitive sed

    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...
  2. IMAUser

    Case insensitive sed

    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...
  3. IMAUser

    Strip the last 4 characters

    Dont worry. Found the answer with regexp_replace :)
  4. IMAUser

    Strip the last 4 characters

    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...
  5. IMAUser

    ; followed by nothing else but ;

    Sorry, got sucked into another issue with a higher priority... Will probably look at the solutions later on... But Many thanks for your help.
  6. IMAUser

    ; followed by nothing else but ;

    Sorry, I would expect to see --------------------------------- 1 CREATE TABLE .... 2 .... 3 ; 4 ; 5 6 CREATE TABLE ... 7 ; 8 9 CREATE TABLE ... 10 ; ; 11 12 CREATE TABLE ... 13 / 14 15 CREATE TABLE ... 16 / 17 ; --------------------------- Sorry, I didnt know how to mark the lines so I...
  7. IMAUser

    ; followed by nothing else but ;

    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...
  8. IMAUser

    Need only the first occurances of these statements from the group

    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...
  9. IMAUser

    Need only the first occurances of these statements from the group

    Probably I am not doing something right, but it dosent seem to work for me....
  10. IMAUser

    Need only the first occurances of these statements from the group

    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...
  11. IMAUser

    Need only the first occurances of these statements from the group

    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...
  12. IMAUser

    work on each line returned by GREP

    I used the solution posted by MoreFeo and it worked the trick. Will try the others later on... Thanks for the suggestions.
  13. IMAUser

    work on each line returned by GREP

    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...
  14. IMAUser

    AWK: search and replace

    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...
  15. IMAUser

    Duplicating a few lines with a modification

    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.
  16. IMAUser

    Duplicating a few lines with a modification

    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.
  17. IMAUser

    Duplicating a few lines with a modification

    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.
  18. IMAUser

    Duplicating a few lines with a modification

    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...
  19. IMAUser

    comment out selected lines

    That helps . Thanks.
  20. IMAUser

    comment out selected lines

    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...

Part and Inventory Search

Back
Top