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_view
CREATE
VIEW(7) SQL Commands CREATE VIEW(7)
NAME
CREATE VIEW - define a new view
SYNOPSIS
CREATE [ OR REPLACE ] VIEW view [ ( column name list ) ] AS SELECT query
INPUTS
view The name (optionally schema-qualified) of a view to be created.
column name list
An optional list of names to be used for columns of the view. If given, these names override the column names that would be deduced
from the SQL query.
query An SQL query (that is, a SELECT statement) which will provide the columns and rows of the view.
Refer to SELECT [select(7)] for more information about valid arguments.
OUTPUTS
CREATE VIEW
The message returned if the view is successfully created.
ERROR: Relation 'view' already exists
This error occurs if the view specified already exists in the database.
WARNING: Attribute 'column' has an unknown type
The view will be created having a column with an unknown type if you do not specify it. For example, the following command gives a
warning:
CREATE VIEW vista AS SELECT 'Hello World'
whereas this command does not:
CREATE VIEW vista AS SELECT text 'Hello World'
DESCRIPTION
CREATE VIEW defines a view of a query. The view is not physically materialized. Instead, a query rewrite rule (an ON SELECT rule) is auto-
matically generated to support SELECT operations on views.
CREATE OR REPLACE VIEW is similar, but if a view of the same name already exists, it is replaced. You can only replace a view with a new
query that generates the identical set of columns (i.e., same column names and data types).
If a schema name is given (for example, CREATE VIEW myschema.myview ...) then the view is created in the specified schema. Otherwise it is
created in the current schema (the one at the front of the search path; see CURRENT_SCHEMA()). The view name must be distinct from the
name of any other view, table, sequence, or index in the same schema.
NOTES
Currently, views are read only: the system will not allow an insert, update, or delete on a view. You can get the effect of an updatable
view by creating rules that rewrite inserts, etc. on the view into appropriate actions on other tables. For more information see CREATE
RULE [create_rule(7)].
Use the DROP VIEW statement to drop views.
USAGE
Create a view consisting of all Comedy films:
CREATE VIEW kinds AS
SELECT *
FROM films
WHERE kind = 'Comedy';
SELECT * FROM kinds;
code | title | did | date_prod | kind | len
-------+---------------------------+-----+------------+--------+-------
UA502 | Bananas | 105 | 1971-07-13 | Comedy | 01:22
C_701 | There's a Girl in my Soup | 107 | 1970-06-11 | Comedy | 01:36
(2 rows)
COMPATIBILITY
SQL92
SQL92 specifies some additional capabilities for the CREATE VIEW statement:
CREATE VIEW view [ column [, ...] ]
AS SELECT expression [ AS colname ] [, ...]
FROM table [ WHERE condition ]
[ WITH [ CASCADE | LOCAL ] CHECK OPTION ]
The optional clauses for the full SQL92 command are:
CHECK OPTION
This option is to do with updatable views. All INSERT and UPDATE commands on the view will be checked to ensure data satisfy the
view-defining condition. If they do not, the update will be rejected.
LOCAL Check for integrity on this view.
CASCADE
Check for integrity on this view and on any dependent view. CASCADE is assumed if neither CASCADE nor LOCAL is specified.
CREATE OR REPLACE VIEW is a PostgreSQL language extension.
SQL - Language Statements 2002-11-22 CREATE VIEW(7)