10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Would like to insert value between two empty delimiter and at the very last too if empty.
$ cat customerleft.tbl
300|Customer#000000300|I0fJfo60DRqQ|7|17-165-193-5964|8084.92|\N|p fluffily among the slyly express grouches. furiously express instruct||||||||||||||||||||||||\N... (3 Replies)
Discussion started by: Mannu2525
3 Replies
2. Shell Programming and Scripting
Given a csv file with 40 columns with name, address, hometown etc.
I use a bash command in 1 line which:
1. gets the address column and pipes that to
2. grep the first digit and everything that follows
Command:
awk -F ";" '{print $19}' /Users/jb/Desktop/ReorderTempTotal.csv | grep -o "\d.*"... (7 Replies)
Discussion started by: JBVeenstra
7 Replies
3. Shell Programming and Scripting
Hi All ,
I have pipe delimiter file with 11 columns . I need to insert 4 empty columns after column 10 . and After 11 column I need to insert a column which is having the same value for all the rows .
My file
1|2|3|4|5|6|7|8|9|10|11
New file
... (11 Replies)
Discussion started by: Hypesslearner
11 Replies
4. Shell Programming and Scripting
Hi,
I have a tab delimited flat file, for example shown below
Name Desg Loc
a b c
d e fI want to insert an empty column inbetween the column Desc and Loc, the result should be like shown below:
Name LName Desg Loc
a b c
d e ... (6 Replies)
Discussion started by: sampoorna
6 Replies
5. Shell Programming and Scripting
Hi,
I want to insert the text 'Unknown' in 2 specific columns in a csv file (actually | separated) if the column is blank. Its always the same columns.
I have tried using sed: sed "s/||/|Unknown|/g"
but there are occasion where other fields are blank and they need to be left blank. This... (4 Replies)
Discussion started by: ksexton
4 Replies
6. Shell Programming and Scripting
I have an awk script to extract data from several files and create output in the following format as a csv file:
xxxx 01/04/12 0001 0
When data is present, I have a file. When no data is available in the input files, I would still like to create a file that looks like this:
xxxx... (1 Reply)
Discussion started by: banjo25
1 Replies
7. Shell Programming and Scripting
I have a directory with several hundred files.
The file format is a space delimited row with an unknown number of columns:
A B C D E F G ...
I need to turn this format
File1 A
File1 B
File2 A
File3 A
File3 B
File3 C
...
I can use grep to display the filename next to each row of... (2 Replies)
Discussion started by: newreverie
2 Replies
8. Shell Programming and Scripting
Hi! i've been reading you guys for some time, now there is something I couldn't find here,
I'm trying to purge some data for my thesis but my measurements have some gaps in the third columns.
The solution is simple,
-Erase those lines where the third column is empty
¿How?
example... (1 Reply)
Discussion started by: AriasFco
1 Replies
9. Shell Programming and Scripting
I can't seem to get sed to allow me to insert text in the first line of an empty file. I have a file.txt that is a 0 byte file. I want sed to insert " fooBar" onto the first line. I've tried a few options and nothing seems to work. They work just fine if there's text in the file tho. Help? (4 Replies)
Discussion started by: DC Slick
4 Replies
10. Shell Programming and Scripting
Hi
I need to do some thing like "find and insert before that " in a file which contains many records. This will be clear with the following example.
The original data record should be some thing like this
60119827 RTMS_LOCATION_CDR INSTANT_POSITION_QUERY 1236574686123083rtmssrv7 ... (8 Replies)
Discussion started by: aemunathan
8 Replies
INSERT(7) SQL Commands INSERT(7)
NAME
INSERT - create new rows in a table
SYNOPSIS
INSERT INTO table [ ( column [, ...] ) ]
{ DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) | SELECT query }
INPUTS
table The name (optionally schema-qualified) of an existing table.
column The name of a column in table.
DEFAULT VALUES
All columns will be filled by null values or by values specified when the table was created using DEFAULT clauses.
expression
A valid expression or value to assign to column.
DEFAULT
This column will be filled in by the column DEFAULT clause, or NULL if a default is not available.
query A valid query. Refer to the SELECT statement for a further description of valid arguments.
OUTPUTS
INSERT oid 1
Message returned if only one row was inserted. oid is the numeric OID of the inserted row.
INSERT 0 #
Message returned if more than one rows were inserted. # is the number of rows inserted.
DESCRIPTION
INSERT allows one to insert new rows into a table. One can insert a single row at a time or several rows as a result of a query. The col-
umns in the target list may be listed in any order.
Each column not present in the target list will be inserted using a default value, either a declared DEFAULT value or NULL. PostgreSQL will
reject the new column if a NULL is inserted into a column declared NOT NULL.
If the expression for each column is not of the correct data type, automatic type coercion will be attempted.
You must have insert privilege to a table in order to append to it, as well as select privilege on any table specified in a WHERE clause.
USAGE
Insert a single row into table films:
INSERT INTO films VALUES
('UA502','Bananas',105,'1971-07-13','Comedy',INTERVAL '82 minute');
In this second example the last column len is omitted and therefore it will have the default value of NULL:
INSERT INTO films (code, title, did, date_prod, kind)
VALUES ('T_601', 'Yojimbo', 106, DATE '1961-06-16', 'Drama');
In the third example, we use the DEFAULT values for the date columns rather than specifying an entry.
INSERT INTO films VALUES
('UA502','Bananas',105,DEFAULT,'Comedy',INTERVAL '82 minute');
INSERT INTO films (code, title, did, date_prod, kind)
VALUES ('T_601', 'Yojimbo', 106, DEFAULT, 'Drama');
Insert a single row into table distributors; note that only column name is specified, so the omitted column did will be assigned its
default value:
INSERT INTO distributors (name) VALUES ('British Lion');
Insert several rows into table films from table tmp:
INSERT INTO films SELECT * FROM tmp;
Insert into arrays (refer to the PostgreSQL User's Guide for further information about arrays):
-- Create an empty 3x3 gameboard for noughts-and-crosses
-- (all of these queries create the same board attribute)
INSERT INTO tictactoe (game, board[1:3][1:3])
VALUES (1,'{{"","",""},{},{"",""}}');
INSERT INTO tictactoe (game, board[3][3])
VALUES (2,'{}');
INSERT INTO tictactoe (game, board)
VALUES (3,'{{,,},{,,},{,,}}');
COMPATIBILITY
SQL92
INSERT is fully compatible with SQL92. Possible limitations in features of the query clause are documented for SELECT [select(7)].
SQL - Language Statements 2002-11-22 INSERT(7)