05-14-2008
sed to fix view names
I have a ddl file which have lots of view in it. I want to replace all the existing views with VW_< view name> . I am prefixing VW to existing view name .
For example, In old file grep on view is like this
CREATE VIEW OPSDM001.PROVIDER_MBR_PRI ( MBR_PRI_PROV_SYS_ID, MBR_PRI_COS_PROV_SPCL_CD,
CREATE VIEW OPSDM001.PROVIDER_REF ( REF_PROV_SYS_ID, REF_COS_PROV_SPCL_CD,
CREATE VIEW OPSDM001.PROVIDER_SRVC ( SRVC_PROV_SYS_ID, SRVC_COS_PROV_SPCL_CD,
but after editing , I want the result like this
CREATE VIEW OPSDM001.VW_PROVIDER_MBR_PRI ( MBR_PRI_PROV_SYS_ID, MBR_PRI_COS_PROV_SPCL_CD,
CREATE VIEW OPSDM001.VW_PROVIDER_REF ( REF_PROV_SYS_ID, REF_COS_PROV_SPCL_CD,
CREATE VIEW OPSDM001.VW_PROVIDER_SRVC ( SRVC_PROV_SYS_ID, SRVC_COS_PROV_SPCL_CD,
It could take care of any number of view occurance .
Any help is appreciated ,
Thanks in advance ,
10 More Discussions You Might Find Interesting
1. OS X (Apple)
ive looked and couldnt find an answer...
can someone tell me how i can replace spaces and characters with an "_" on multiple folders?
thanx muchly. (1 Reply)
Discussion started by: RahJiggah
1 Replies
2. Shell Programming and Scripting
Dear forum,
I need to rename a bunch of files according to their first line, in CamelCase. I am having problems with the conversion from "normal string title" or "NST syndrome" to, respectively, "NormalString" or "NSTSyndrome".
First character of a word to uppercase and drop spaces.
I was... (1 Reply)
Discussion started by: vlf
1 Replies
3. Shell Programming and Scripting
For lists in sed, to say what to replace, is this correct:
I am hoping that this would recognise that either a "." is present, or that the substitution happens at the end of the line.
For files with extensions , my script works perfectly.
My problem is, files without extentions, i.e. . ... (1 Reply)
Discussion started by: busillis
1 Replies
4. Shell Programming and Scripting
Sun Solaris Unix Question
Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies
5. Shell Programming and Scripting
Hi
I am dealing with the following string:
Date: Thur, 13 March 2011 01:01:10 +0000
I asked for help in another topic that converted a similar string:
Date: Thur, 13 March 2011 9:50 AM
To a 24 hr standard. The problem is that it comes out as:
Date: Thur, 13 March 2011 9:50:00 +0000... (4 Replies)
Discussion started by: duonut
4 Replies
6. UNIX for Dummies Questions & Answers
last night our server was hit with an attack that infected every php file on the server and inserted the following code
/*god_mode_on*/eval(base64_decode with a ton of other characters after.
As it infected every php file i have been trying to clean it using a
sed command to go through... (2 Replies)
Discussion started by: derrickyoung95
2 Replies
7. Shell Programming and Scripting
how can i make find/sed to include directory names with spaces
the command is like this
for i in `find wp-content/themes -type f -print0 | xargs -0 grep -l
-iE 'e'`;do sed -i -e 's/word1/word2/gI' "$i";done
but it skips one directory names with spaces
sed: can't read ./Nova: No such... (5 Replies)
Discussion started by: vanessafan99
5 Replies
8. Shell Programming and Scripting
Data files coming in different names in a file name called process.txt.
1. shipments_yyyymmdd.gz
2 Order_yyyymmdd.gz
3. Invoice_yyyymmdd.gz
4. globalorder_yyyymmdd.gz
The process needs to discard all the below files and only process two of the 4 file names available
... (1 Reply)
Discussion started by: dsravanam
1 Replies
9. UNIX for Beginners Questions & Answers
Dear Users,
Appreciate your help if you could help me with splitting a large file > 1 million lines with sed or awk. below is the text in the file
input file.txt
scaffold1 928 929 C/T +
scaffold1 942 943 G/C +
scaffold1 959 960 C/T +... (6 Replies)
Discussion started by: kapr0001
6 Replies
10. What is on Your Mind?
See attached video for a demo on how to move back and forth from the desktop view to the mobile view.
Currently this only works for the home page, but I will work on some new PHP code in the future to make this work with the page we are currently on.
Edit: The issue with making every page ... (2 Replies)
Discussion started by: Neo
2 Replies
LEARN ABOUT REDHAT
create_schema
CREATE
SCHEMA(7) SQL Commands CREATE SCHEMA(7)
NAME
CREATE SCHEMA - define a new schema
SYNOPSIS
CREATE SCHEMA schemaname [ AUTHORIZATION username ] [ schema_element [ ... ] ]
CREATE SCHEMA AUTHORIZATION username [ schema_element [ ... ] ]
INPUTS
schemaname
The name of a schema to be created. If this is omitted, the user name is used as the schema name.
username
The name of the user who will own the schema. If omitted, defaults to the user executing the command. Only superusers may create
schemas owned by users other than themselves.
schema_element
An SQL statement defining an object to be created within the schema. Currently, only CREATE TABLE, CREATE VIEW, and GRANT are
accepted as clauses within CREATE SCHEMA. Other kinds of objects may be created in separate commands after the schema is created.
OUTPUTS
CREATE SCHEMA
Message returned if the command is successful.
ERROR: namespace "schemaname" already exists
If the schema specified already exists.
DESCRIPTION
CREATE SCHEMA will enter a new schema into the current database. The schema name must be distinct from the name of any existing schema in
the current database.
A schema is essentially a namespace: it contains named objects (tables, data types, functions, and operators) whose names may duplicate
those of other objects existing in other schemas. Named objects are accessed either by ``qualifying'' their names with the schema name as a
prefix, or by setting a search path that includes the desired schema(s).
Optionally, CREATE SCHEMA can include subcommands to create objects within the new schema. The subcommands are treated essentially the same
as separate commands issued after creating the schema, except that if the AUTHORIZATION clause is used, all the created objects will be
owned by that user.
NOTES
To create a schema, the invoking user must have CREATE privilege for the current database. (Of course, superusers bypass this check.)
Use DROP SCHEMA to remove a schema.
EXAMPLES
Create a schema:
CREATE SCHEMA myschema;
Create a schema for user joe --- the schema will also be named joe:
CREATE SCHEMA AUTHORIZATION joe;
Create a schema and create a table and view within it:
CREATE SCHEMA hollywood
CREATE TABLE films (title text, release date, awards text[])
CREATE VIEW winners AS
SELECT title, release FROM films WHERE awards IS NOT NULL;
Notice that the individual subcommands do not end with semicolons.
The following is an equivalent way of accomplishing the same result:
CREATE SCHEMA hollywood;
CREATE TABLE hollywood.films (title text, release date, awards text[]);
CREATE VIEW hollywood.winners AS
SELECT title, release FROM hollywood.films WHERE awards IS NOT NULL;
COMPATIBILITY
SQL92
SQL92 allows a DEFAULT CHARACTER SET clause in CREATE SCHEMA, as well as more subcommand types than are presently accepted by PostgreSQL.
SQL92 specifies that the subcommands in CREATE SCHEMA may appear in any order. The present PostgreSQL implementation does not handle all
cases of forward references in subcommands; it may sometimes be necessary to reorder the subcommands to avoid forward references.
In SQL92, the owner of a schema always owns all objects within it. PostgreSQL allows schemas to contain objects owned by users other than
the schema owner. This can happen only if the schema owner grants CREATE rights on his schema to someone else.
SQL - Language Statements 2002-11-22 CREATE SCHEMA(7)