Its really 2 questions, but both are pretty basic.
Linux Redhat
1. Need to do a search and replace on a file.
I need to append '--' (comment out the line) to specific lines based on a wildcard search.
So if I Have
GRANT SOME_ROLE_OR_USER ...
I dont care what comes after that. SOME_ROLE_OR_USER will change so Ill edit it as needed. I can't guarantee the number of spaces after GRANT. I also need this to be case insensitive.
2. Egrep:
SOME ORACLE COMMAND <should be one line
*
ERROR at line 1:
ORA-0000: some error message
-- Notes
Could be ORA-, PLS-,TNS-, or possible 1 or 2 other things.
May be multiple lines of ORA/PLS and could be a mixture.
I need to return, The command above (I believe its always indented) and then the oracle error message and number which can be more than 1 line.
I do not think the multiple lines of Oracle Error messages will have 'spaces' between them'
I can't guarantee you will see ERROR at Line 1: (or whatever number), but
ORA-,PLS-,TNS-, (And possible some others I can find will be present)
I need to find this. So I can just pull out error messages and the command that caused the error from a log file.
Moderator's Comments:
|
|
If you have two distinct questions then please open two threads.. And use a more descriptive title than sed question or egrep question
|
|