01-09-2015
You'll either have to alter the table by adding another column or you could create a view on both tables.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I am trying to use vlookup (Excel function) using awk but there is some problem :(
--file1--
ABC123
101F
X1 A $P=Z
X2 A $P=X
X3 B $P=F
X4 C $P=G
MNK180
END
--file2--
X1 A_t $P=Z
X2 A_t $P=X
X3 B_u $P=F
X4 C_o $P=G (2 Replies)
Discussion started by: young
2 Replies
2. Shell Programming and Scripting
Hi,
I am new to awk/unix and am trying to put together an awk script to perform an action similar to vlookup between the two csv files.
Here are the contents of the two files:
File 1:
Date,ParentID,Number,Area,Volume,Dimensions
2014-01-01,ABC,247,83430.33,857.84,8110.76... (9 Replies)
Discussion started by: Prit Siv
9 Replies
3. Shell Programming and Scripting
Hi folks,
awk 'NR==FNR {m=$0; next} $1 in m{$0=m} {print}' file2 file1
Works a charm for a vlookup type query, sourced from https://www.unix.com/shell-programming-and-scripting/215998-vlookup-using-awk.html
However my column content has white spaces and numbers. Example
file1
The Man... (6 Replies)
Discussion started by: pshields1984
6 Replies
4. Shell Programming and Scripting
I have two files
File1
175552 st_497858.1 rs86052.1 rs92185.1 st_001022416.1 174841 175552_174841
179912 st_001122967.2 rs90435.1 rs89122.1 st_001022583.1 175545 179912_175545
179912 st_001122967.2 rs90435.1 rs89122.1 st_001022584.1 175545 179912_175545
179967 st_001256606.1 rs93516.2... (1 Reply)
Discussion started by: sammy777888
1 Replies
5. Shell Programming and Scripting
Source file 1
335 R1-snapfound 0098F RDFType:R1 R2-Dev R2-snapfound ,010C0 RemoteSymmetrixID:345
335 R1-snapfound 00990 RDFType:R1 R2-Dev R2-snapfound ,010C1 RemoteSymmetrixID:345
335 R1-snapfound 009C0 RDFType:R1 R2-Dev R2-snapfound ,009C1 RemoteSymmetrixID:345
335 R1-snapfound 009C1... (5 Replies)
Discussion started by: ranjancom2000
5 Replies
6. Shell Programming and Scripting
Code used to find the server from cloum 3 and update needtotakesnap
Output came from above command
awk 'NR==FNR{A;next}$3 in A{$3 = "needtotakesnap " $3}1' /home/Others/active-server.txt /home/Others/all-server |grep server1
879 dummy server1_217_silver dummy 00870 TDEV 2071575
831 Tier1... (3 Replies)
Discussion started by: ranjancom2000
3 Replies
7. Shell Programming and Scripting
I need to vlookup and check the server not found.
Source file 1
server1
server2
server3
server4
server5_root
server6_silver
server7
server7-test
server7-temp
Source file 2
server1_bronze (6 Replies)
Discussion started by: ranjancom2000
6 Replies
8. Shell Programming and Scripting
Hello Folks,
What I wish to do is:
If first column matches in main and new file, then
paste $COL2 into output file. Something like vlookup. Please see also bold text in expected output.
mainfile
11
22
33
44
55
66
77
88
99
100
101
102 (4 Replies)
Discussion started by: baris35
4 Replies
9. UNIX for Beginners Questions & Answers
Hello, i am trying to print group name column(etc/group) on script (etc/passwd) since group name is not listed on etc/passwd columns. Im trying to do a vlookup. but i cant figure out how i can insert the vlookup command FNR==NR inside the print out command or the output. I also tried exporting... (2 Replies)
Discussion started by: joonisio
2 Replies
10. UNIX for Beginners Questions & Answers
Hi I just want again to ask for help on what command to use to vlookup f1 group name in "/etc/group" matching f3 of it to "/etc/passwd" f4. I do need to display group name in the output of /etc/passwd without using awk or NR==FNR command. thank you
while
IFS=: read -r f1 f2 f3 f4 f5 f6 f7... (4 Replies)
Discussion started by: joonisio
4 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)