Sponsored Content
Top Forums Shell Programming and Scripting Need to merge lines based on pattern Post 302803359 by anbu23 on Monday 6th of May 2013 01:11:56 PM
Old 05-06-2013
Code:
$ sed "/CONSTRAINT/,/^ *$/{H;/^ *$/{x;s/\n//gp;};d;}" file
CREATE TABLE "AMS_DISTRIBUTOR_XREF"
   (
    "SOURCE" VARCHAR2(3) NOT NULL ENABLE,
    "USER_CHANGED" VARCHAR2(30) NOT NULL ENABLE,
    "DATE_CHANGED" DATE NOT NULL ENABLE,
     CONSTRAINT "PK_AMS_DISTRIBUTOR_XREF" PRIMARY KEY ("DISTRIBUTOR_ID     ", ROLE_CODE, "PARTICIPANT_ID")
  ) TABLESPACE "TBLSP01" ;

CREATE TABLE AMS_LTV_STATUS"
   (    "INST_ID" NUMBER(10,0) NOT NULL ENABLE,
    "MPAN" NUMBER(13,0) NOT NULL ENABLE,
    "LTV_START_DATE" DATE,
     CONSTRAINT "AMS_LTV_STATUS_PK" PRIMARY KEY ("INST_ID")
 )   TABLESPACE "TBLSP02";

CREATE TABLE "CNT_PRO_PARTY_BANK_ACC_DETAILS"
   (    "BANK_ACCOUNT_NO" VARCHAR2(18),
    "BANK_DETAILS_ID" VARCHAR2(4) NOT NULL ENABLE,
    "ACCOUNT_HOLDER_NAME" VARCHAR2(60),
    "OWNER" VARCHAR2(20),
      CONSTRAINT "CNT_PRO_BANK_DTLS_PK" PRIMARY KEY ("MSP_PARTY_ID", "BANK_DETAILS_ID")
  ) TABLESPACE "TBLSP02" ;

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Merge lines in Flat file based on first 5 characters

Hi I have the fixed width flat file having the following data 12345aaaaaaaaaabbbbbbbbbb 12365sssssssssscccccccccc 12365sssss 12367ddddddddddvvvvvvvvvv 12367 vvvvv Here the first column is length 5 second is length 10 third is length 10 if the second or third column exceeds... (3 Replies)
Discussion started by: Brado
3 Replies

2. Shell Programming and Scripting

Merge two file data together based on specific pattern match

My input: File_1: 2000_t g1110.b1 abb.1 2001_t g1111.b1 abb.2 abb.2 g1112.b1 abb.3 2002_t . . File_2: 2000_t Ali england 135 abb.1 Zoe british 150 2001_t Ali england 305 g1111.b1 Lucy russia 126 (6 Replies)
Discussion started by: patrick87
6 Replies

3. Shell Programming and Scripting

Merge lines in text file based on pattern

Hello, I have searched forum trying to find a solution to my problem, but could not find anything or I did not understand the examples.... I should say, I am very inexperienced with text processing. I have a text file with approx 60k lines in it. I need to merge lines based on the number... (8 Replies)
Discussion started by: Bertik
8 Replies

4. Shell Programming and Scripting

Merge lines from one file if pattern matches

I have one comma separated file (a.txt) with two or more records all matching except for the last column. I would like to merge all matching lines into one and consolidate the last column, separated by ":". Does anyone know of a way to do this easily? I've searched the forum but most talked... (6 Replies)
Discussion started by: giannicello
6 Replies

5. Shell Programming and Scripting

merge same pattern lines together

Hi people... I normally find with out any problem the solutions I need just by searching. But for this I'm not having any joy or jsut failing to adapt what I'ev found to work. I have applciation report that doesn't allow for manipulation at creation so I want to do some post modifcation... (2 Replies)
Discussion started by: nhatch
2 Replies

6. Shell Programming and Scripting

Merge lines if pattern matches in ksh

I have a file like this. Pls help me to solve this . (I should look for only Message : 111 and need to print the start time to end time Need to ignore other type of messages. Ex: if first message is 111 and second message is 000 or anything else then ignore the 2nd one and print start time of the... (1 Reply)
Discussion started by: mnjx
1 Replies

7. Shell Programming and Scripting

Merge file lines based off of keyword

Hello Everyone, I have two files I created in a format similar to the ones found below (character position is important): File 1: 21 Cat Y N S Y Y N N FOUR LEGS TAIL WHISKERS 30 Dog N N 1 Y Y N N FOUR LEGS TAIL 33 Fish Y N 1 Y Y N N FINS 43 CAR Y N S Y Y N N WHEELS DOORS... (7 Replies)
Discussion started by: jl487
7 Replies

8. Shell Programming and Scripting

How to merge lines based off of text?

Hello Everyone, I have two files, similar to the following: File 1: 8010 ITEM01 CODE1 FLAG1 filler filler 7020 OBJECT CODE2 FLAG2 filler 6010 THING1 CODE4 FLAG4 6011 ITEM20 CODE7 FLAG7 File 2 contains: 6020 ITEM01 CODEA FLAGA filler filler filler 7000 OBJECT CODEB... (2 Replies)
Discussion started by: jl487
2 Replies

9. Shell Programming and Scripting

Merge mutiple lines into one based on if the first word is some particular value

Hi, trying to knock something together to create one line entries based on whether the first word on each line matches a particular value. eg. Link,"Name=""Something\something"","Timeout=""1800""", "Target=""\\thing\thing\thing""","State=""ONLINE""",something,... (0 Replies)
Discussion started by: adamdb
0 Replies

10. Shell Programming and Scripting

Merge lines based on match

I am trying to merge two lines to one based on some matching condition. The file is as follows: Matches filter: 'request ', timestamp, <HTTPFlow request=<GET: Matches filter: 'request ', timestamp, <HTTPFlow request=<GET: Matches filter: 'request ', timestamp, <HTTPFlow ... (8 Replies)
Discussion started by: jamie_123
8 Replies
CREATE CONSTRAINT 
TRIGGER(7) SQL Commands CREATE CONSTRAINT TRIGGER(7) NAME
CREATE CONSTRAINT TRIGGER - define a new constraint trigger SYNOPSIS
CREATE CONSTRAINT TRIGGER name AFTER event [ OR ... ] ON table_name [ FROM referenced_table_name ] { NOT DEFERRABLE | [ DEFERRABLE ] { INITIALLY IMMEDIATE | INITIALLY DEFERRED } } FOR EACH ROW EXECUTE PROCEDURE funcname ( arguments ) DESCRIPTION
CREATE CONSTRAINT TRIGGER creates a constraint trigger. This is the same as a regular trigger except that the timing of the trigger firing can be adjusted using SET CONSTRAINTS [set_constraints(7)]. Constraint triggers must be AFTER ROW triggers. They can be fired either at the end of the statement causing the triggering event, or at the end of the containing transaction; in the latter case they are said to be deferred. A pending deferred-trigger firing can also be forced to happen immediately by using SET CONSTRAINTS. PARAMETERS
name The name of the constraint trigger. This is also the name to use when modifying the trigger's behavior using SET CONSTRAINTS. The name cannot be schema-qualified -- the trigger inherits the schema of its table. event One of INSERT, UPDATE, or DELETE; this specifies the event that will fire the trigger. Multiple events can be specified using OR. table_name The (possibly schema-qualified) name of the table in which the triggering events occur. referenced_table_name The (possibly schema-qualified) name of another table referenced by the constraint. This option is used for foreign-key constraints and is not recommended for general use. DEFERRABLE NOT DEFERRABLE INITIALLY IMMEDIATE INITIALLY DEFERRED The default timing of the trigger. See the CREATE TABLE [create_table(7)] documentation for details of these constraint options. funcname The function to call when the trigger is fired. See CREATE TRIGGER [create_trigger(7)] for details. arguments Optional argument strings to pass to the trigger function. See CREATE TRIGGER [create_trigger(7)] for details. COMPATIBILITY
CREATE CONSTRAINT TRIGGER is a PostgreSQL extension of the SQL standard. SEE ALSO
CREATE TRIGGER [create_trigger(7)], DROP TRIGGER [drop_trigger(7)], SET CONSTRAINTS [set_constraints(7)] SQL - Language Statements 2010-05-14 CREATE CONSTRAINT TRIGGER(7)
All times are GMT -4. The time now is 09:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy