Sponsored Content
Top Forums Shell Programming and Scripting extract DDL - output every match to separate file Post 302554642 by CactusMoon on Monday 12th of September 2011 01:33:43 PM
Old 09-12-2011
Quote:
Originally Posted by ahamed101
Code:
awk '/^--/{next}/CREATE UNIQUE INDEX|CREATE INDEX/{file=$NF;print>file".ddl";next}{print>file".ddl"}' input.ddl

Assuming this file has only index create statements!

--ahamed

this one worked for me! great! thank you!

couldnīt try the other one because i currntly donīt have gawk installed.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Output of command to 2 separate file?

How would I echo the same results to two files? One is a running log, and the other is a cache, or sort. echo "Hello World" >> /Logs/File1 & /tmp/file2 I would just copy it from one place to the other, but the Log keeps history, where I want the /tmp to hold only stuff per session. I tried... (2 Replies)
Discussion started by: TheCrunge
2 Replies

2. Shell Programming and Scripting

extract x lines after a pattern - place each result in separate file

Hi all, I have many files that have 1 or more occurrences of the information I want. There are two distinct sets of information. I want get this info and place each occurrence in its own file. The 3 lines before one set are this grid 00 01 02 16 17 18 **40 lines of code I want to... (5 Replies)
Discussion started by: gobi
5 Replies

3. Shell Programming and Scripting

Help required to parse Oracle imp show=y output to DDL Commands

Hi, I generated an Oracle schema DDL script file using the show=y option of the Oracle import utility but the file that it generates needs a little more formating before we can run this as simple DDL comands to generate the schema at Target using the script file.Here is the simplified output of... (1 Reply)
Discussion started by: rajan_san
1 Replies

4. Shell Programming and Scripting

extract nth line of all files and print in output file on separate lines.

Hello UNIX experts, I have 124 text files in a directory. I want to extract the 45678th line of all the files sequentialy by file names. The extracted lines should be printed in the output file on seperate lines. e.g. The input Files are one.txt, two.txt, three.txt, four.txt The cat of four... (1 Reply)
Discussion started by: yogeshkumkar
1 Replies

5. Shell Programming and Scripting

Extract table name from DDL

How can I extract table name from the different DDL statement like ALTER TABLE CREATE TABLE etc Basically I have to parse thr the any of the DDL statement and verify if that DDL statement is implemented by DBA or not. how can i do this efficiently in Kornshell scripting. (2 Replies)
Discussion started by: gayathree
2 Replies

6. UNIX for Dummies Questions & Answers

awk to match multiple regex and create separate output files

Howdy Folks, I have a list that looks like this: (file2.txt) AAA BBB CCC DDD and there are 24 of these short words. I am matching these patterns to another file with 755795 lines (file1.txt). I have this code for matching: awk -v f2=file2.txt ' BEGIN { while(... (2 Replies)
Discussion started by: heecha
2 Replies

7. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

8. Shell Programming and Scripting

Trying to use diff output to compare to a separate file

I have two files: smw:/working/iso_testing # cat a QConvergeConsoleCLI-1.1.03-49.x86_64.rpm aaa_base-13.2+git20140911.61c1681-1.3.i586.rpm acpica-20140724-2.1.2.i586.rpm test.rpm smw:/working/iso_testing # cat b QConvergeConsoleCLI-1.1.03-49.x86_64.rpm... (12 Replies)
Discussion started by: jedlund21
12 Replies

9. Programming

creating separate output file for each input file in python

Experts, Need your help for this. Please support My motive is to create seperate output file for each Input Files(File 1 and File2) in another folder say(/tmp/finaloutput) Input files File 1(1.1.1.1.csv) a,b,c 43,17104773,3 45,17104234,4 File 2(2.2.2.2.csv) a,b,c 43,17104773,1... (2 Replies)
Discussion started by: as7951
2 Replies

10. UNIX for Beginners Questions & Answers

Match file and extract the output

Hi All I have 2 file . I need match the files based on key and then form a third file which have the matching values FILE1: 10264;K*AD 10265;K*AIR 10266;K*AUTO 10267;K*BABY 10268;K* FOOD FILE2: 10264;1055.83 10265;716.94 10267;331.80 10268;23283.33 OUTPUT (Needed)... (2 Replies)
Discussion started by: arunkumar_mca
2 Replies
CREATE 
TABLESPACE(7) SQL Commands CREATE TABLESPACE(7) NAME
CREATE TABLESPACE - define a new tablespace SYNOPSIS
CREATE TABLESPACE tablespacename [ OWNER username ] LOCATION 'directory' DESCRIPTION
CREATE TABLESPACE registers a new cluster-wide tablespace. The tablespace name must be distinct from the name of any existing tablespace in the database cluster. A tablespace allows superusers to define an alternative location on the file system where the data files containing database objects (such as tables and indexes) can reside. A user with appropriate privileges can pass tablespacename to CREATE DATABASE, CREATE TABLE, CREATE INDEX or ADD CONSTRAINT to have the data files for these objects stored within the specified tablespace. PARAMETERS
tablespacename The name of a tablespace to be created. The name cannot begin with pg_, as such names are reserved for system tablespaces. username The name of the user who will own the tablespace. If omitted, defaults to the user executing the command. Only superusers can create tablespaces, but they can assign ownership of tablespaces to non-superusers. directory The directory that will be used for the tablespace. The directory must be empty and must be owned by the PostgreSQL system user. The directory must be specified by an absolute path name. NOTES
Tablespaces are only supported on systems that support symbolic links. CREATE TABLESPACE cannot be executed inside a transaction block. EXAMPLES
Create a tablespace dbspace at /data/dbs: CREATE TABLESPACE dbspace LOCATION '/data/dbs'; Create a tablespace indexspace at /data/indexes owned by user genevieve: CREATE TABLESPACE indexspace OWNER genevieve LOCATION '/data/indexes'; COMPATIBILITY
CREATE TABLESPACE is a PostgreSQL extension. SEE ALSO
CREATE DATABASE [create_database(7)], CREATE TABLE [create_table(7)], CREATE INDEX [create_index(7)], DROP TABLESPACE [drop_tablespace(7)], ALTER TABLESPACE [alter_tablespace(7)] SQL - Language Statements 2010-05-14 CREATE TABLESPACE(7)
All times are GMT -4. The time now is 10:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy