11-11-2009
Grep multiple line pattern and output the lines
Hi I have the following Input
--
-- TABLE: BUSINESS_UNIT
--
ALTER TABLE RATINGS.BUSINESS_UNIT ADD CONSTRAINT FK1_BUSINESS_UNIT
FOREIGN KEY (PEOPLESOFT_CHART_FIELD_VALUE_ID)
REFERENCES RATINGS.PEOPLESOFT_CHART_FIELD_VALUE(PEOPLESOFT_CHART_FIELD_VALUE_ID)
;
ALTER TABLE RATINGS.CASE ADD CONSTRAINT FK7_CASE
FOREIGN KEY (ENTITY_ID, VERSION_NBR)
REFERENCES RATINGS.ENTITY_VERSION(ENTITY_ID, VERSION_NBR)
;
ALTER TABLE RATINGS.CANADIAN_PROVINCE ADD CONSTRAINT FK1_CANADIAN_PROVINCE
FOREIGN KEY (ENTITY_ID, VERSION_NBR)
REFERENCES RATINGS.ENTITY_VERSION(ENTITY_ID, VERSION_NBR)
;
--
-- TABLE: CANADIAN_TERRITORY
--
ALTER TABLE RATINGS.CANADIAN_TERRITORY ADD CONSTRAINT FK1_CANADIAN_TERRITORY
FOREIGN KEY (ENTITY_ID, VERSION_NBR)
REFERENCES RATINGS.ENTITY_VERSION(ENTITY_ID, VERSION_NBR)
;
I need to get ouput of alter staments where in it
REFERENCES RATINGS.ENTITY_VERSION
Output looks like
ALTER TABLE RATINGS.CANADIAN_TERRITORY ADD CONSTRAINT FK1_CANADIAN_TERRITORY
FOREIGN KEY (ENTITY_ID, VERSION_NBR)
REFERENCES RATINGS.ENTITY_VERSION(ENTITY_ID, VERSION_NBR)
;
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I've been working on a script which I have hit a road block now. I have written a script using sed to extract the below data and pumped into another file:
Severity............: MAJORWARNING
Summary:
System temperature is out of normal range.
Severity............: MAJORWARNING... (13 Replies)
Discussion started by: phixsius
13 Replies
2. Shell Programming and Scripting
Hi all,
For a intro UNIX course I'm taking, I need to use the command "tr" to display a file on standard output without any newlines (all on one line).
I assume I would start with "cat filename | tr" but don't know what to put after tr.
Any ideas would be lovely!
Thanks. (3 Replies)
Discussion started by: otes4
3 Replies
3. Solaris
Hi,
I would like to search multiple patterns on same line, i.e. all patterns must
present on same line.
Please suggest.
Thanx (2 Replies)
Discussion started by: sanjay1979
2 Replies
4. Shell Programming and Scripting
I have sql file containing lot of queries on different database table. I have to filter specific table queries.
Let say i need all queries of test1,test2,test3 along with four lines above it and sql queries can be multi lines or in single line.
Input file contains.
set INSERT_ID=1;
set... (1 Reply)
Discussion started by: mirfan
1 Replies
5. Shell Programming and Scripting
Hi,
I have got the below requirement. please suggest.
I have a file like,
Processing Item is:
/data/ing/cfg2/abc.txt
/data/ing/cfg3/bgc.txt
Processing Item is:
/data/cmd/for2/ght.txt
/data/kernal/config.klgt.txt
I want to process the above file to get the output file like,
... (5 Replies)
Discussion started by: rbalaj16
5 Replies
6. Shell Programming and Scripting
here is what i want to achieve.. i have a file with below contents
cat fileName
blah blah blah
.
.DROP this
REJECT that
.
--sport 7800 -j REJECT --reject-with icmp-port-unreachable
--dport 7800 -j REJECT --reject-with icmp-port-unreachable
.
.
.
more blah blah blah
--dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies
7. Shell Programming and Scripting
I need to match two patterns in a log file and need to get the next line of the one of the pattern (out of two patterns) that is matched,
finally need to print these three values in a single line.
Sample Log:
2013/06/11 14:29:04 <0999> (725102) Processing batch 02_1231324
2013/06/11... (4 Replies)
Discussion started by: rpm120
4 Replies
8. Shell Programming and Scripting
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies
9. Shell Programming and Scripting
Hi Guys,
I am trying to format my csv file. When I spool the file using sqlplus the single row output is wrapped on three lines.
Somehow I managed to format that file and finally i am trying to make the multiple line on single line.
The below command is working fine but I need to pass the... (3 Replies)
Discussion started by: RJSKR28
3 Replies
10. UNIX for Beginners Questions & Answers
Input file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
LEARN ABOUT SUSE
alter_domain
ALTER
DOMAIN(7) SQL Commands ALTER DOMAIN(7)
NAME
ALTER DOMAIN - change the definition of a domain
SYNOPSIS
ALTER DOMAIN name
{ SET DEFAULT expression | DROP DEFAULT }
ALTER DOMAIN name
{ SET | DROP } NOT NULL
ALTER DOMAIN name
ADD domain_constraint
ALTER DOMAIN name
DROP CONSTRAINT constraint_name [ RESTRICT | CASCADE ]
ALTER DOMAIN name
OWNER TO new_owner
ALTER DOMAIN name
SET SCHEMA new_schema
DESCRIPTION
ALTER DOMAIN changes the definition of an existing domain. There are several sub-forms:
SET/DROP DEFAULT
These forms set or remove the default value for a domain. Note that defaults only apply to subsequent INSERT commands; they do not
affect rows already in a table using the domain.
SET/DROP NOT NULL
These forms change whether a domain is marked to allow NULL values or to reject NULL values. You can only SET NOT NULL when the col-
umns using the domain contain no null values.
ADD domain_constraint
This form adds a new constraint to a domain using the same syntax as CREATE DOMAIN [create_domain(7)]. This will only succeed if
all columns using the domain satisfy the new constraint.
DROP CONSTRAINT
This form drops constraints on a domain.
OWNER This form changes the owner of the domain to the specified user.
SET SCHEMA
This form changes the schema of the domain. Any constraints associated with the domain are moved into the new schema as well.
You must own the domain to use ALTER DOMAIN. To change the schema of a domain, you must also have CREATE privilege on the new schema. To
alter the owner, you must also be a direct or indirect member of the new owning role, and that role must have CREATE privilege on the
domain's schema. (These restrictions enforce that altering the owner doesn't do anything you couldn't do by dropping and recreating the
domain. However, a superuser can alter ownership of any domain anyway.)
PARAMETERS
name The name (possibly schema-qualified) of an existing domain to alter.
domain_constraint
New domain constraint for the domain.
constraint_name
Name of an existing constraint to drop.
CASCADE
Automatically drop objects that depend on the constraint.
RESTRICT
Refuse to drop the constraint if there are any dependent objects. This is the default behavior.
new_owner
The user name of the new owner of the domain.
new_schema
The new schema for the domain.
NOTES
Currently, ALTER DOMAIN ADD CONSTRAINT and ALTER DOMAIN SET NOT NULL will fail if the named domain or any derived domain is used within a
composite-type column of any table in the database. They should eventually be improved to be able to verify the new constraint for such
nested columns.
EXAMPLES
To add a NOT NULL constraint to a domain:
ALTER DOMAIN zipcode SET NOT NULL;
To remove a NOT NULL constraint from a domain:
ALTER DOMAIN zipcode DROP NOT NULL;
To add a check constraint to a domain:
ALTER DOMAIN zipcode ADD CONSTRAINT zipchk CHECK (char_length(VALUE) = 5);
To remove a check constraint from a domain:
ALTER DOMAIN zipcode DROP CONSTRAINT zipchk;
To move the domain into a different schema:
ALTER DOMAIN zipcode SET SCHEMA customers;
COMPATIBILITY
ALTER DOMAIN conforms to the SQL standard, except for the OWNER and SET SCHEMA variants, which are PostgreSQL extensions.
SEE ALSO
CREATE DOMAIN [create_domain(7)], DROP DOMAIN [drop_domain(7)]
SQL - Language Statements 2010-05-14 ALTER DOMAIN(7)