I want to automatically edit the file produced from an Oracle database by running this:
so that I only get the first definition of the control file - i.e. the first part that begins
and ends
This section appears twice in the file (with small differences) and I only want the first occurrence. Both occurrences begin with 'STARTUP NOMOUNT' and end with ';'.
I've tried this (UUOC I know )
which gives me both occurrences (and correctly strips everything else out). But I don't know how to only get the first occurrence.
I can't be certain this will always be on the same lines so I can't print certain line numbers only. I could hack away at removing the 2nd occurrence of the lines but there must be a simpler way to do it.
Hope this makes sense to you all. Any advice appreciated as usual.
Thanks, Chris
Code:
alter database backup controlfile to trace;
Code:
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "OUT_DATABASE" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 5
MAXLOGMEMBERS 5
Code:
'/our_database/indx03.dbf',
'/our_database/indx04.dbf',
'/our_database/cftest_LOB_TS.dbf',
'/our_database/cftest_tools01.dbf'
CHARACTER SET WE8ISO8859P1
;
This section appears twice in the file (with small differences) and I only want the first occurrence. Both occurrences begin with 'STARTUP NOMOUNT' and end with ';'.
I've tried this (UUOC I know )
Code:
cat control.sql | sed -n '/^STARTUP NOMOUNT/,/^;/p'
I can't be certain this will always be on the same lines so I can't print certain line numbers only. I could hack away at removing the 2nd occurrence of the lines but there must be a simpler way to do it.
Hope this makes sense to you all. Any advice appreciated as usual.
Thanks, Chris