my goal is to write a shell script which takes two mysql dump files(one is latest dump which has new changes to be made and other one is older mysql dump) the script compares both the files and and give the delta (that is changed to to be made ) as output. the changes in the sense.. new mysql dump file has two more columns added in the table blahblahblah so the scipt finds out which are the columns missing and from which table and writes alter table query to that particular table. i am stuck in the part where i need to extract table wise from the file and also in comparison between files. right now i have wrote shell script which just prints out lines missing from one file compared to other.. its copy is shown in
---------- Post updated at 03:45 PM ---------- Previous update was at 03:41 PM ----------
this is required for my project since currently we use mysql testbench to get this delta changes of database compared to new changes. and use this delta changes file to alter the old database so that it reflects all the new changes. but i want to avoid using testbench for this function and write a shell script which performs its functions.
---------- Post updated at 05:47 PM ---------- Previous update was at 03:45 PM ----------
Quote:
Originally Posted by ahamed101
Whatever you have mentioned can be done, but what is your ultimate goal?...
these are the column names in the earlier mentioned table. how to extract these column names dynamically cause i want to use it in a function so if i send either
`reserved2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL
or
`zoneId` int(11) DEFAULT NULL
(the above two line will be stored in the variable.. i am using while loop to read from file so technically in first run one column will be held in $line )
it should extract reserved2 or zoneid respectively.. how to do it..?
i need a shell program to extract a substring from a main string..
for eg:- main string is madhu..
sub string is mad
o/p:- be mad.
try to solve this one (5 Replies)
i need a shell program,to extract a string from a main string.
main string is "madhu"
sub string is "mad"..means any word from the main string
please di this (1 Reply)
Hi, guys. I have one question:
I need to search for a string in a file, and then extract another string from the file and assign it to a variable.
For example:
the contents of the file (group) is below:
...
ftp:x:23:
mail:x:34
...
testing:x:2001
sales:x:2002
development:x:2003
...... (6 Replies)
attempting the hangman program. This was an optional assignment from the professor. I have completed the logical coding, debugging now.
##I have an array $wordString that initializes to a string of dashes
##reflecting the number of letters in $theWord
##every time the user enters a (valid)... (5 Replies)
Hi,
May i ask if someone share some command for extracting a string between 2 ref string in a txt file
My objective: i had a file with multiple lines and wants only to extract the string "watch?v=IbkAXOmEHpY" or "watch?v=<11 random character>", when i used "grep 'watch?=*' i got a results per... (4 Replies)
Hi ,
am getting output file, it sontains the below values.
./hawk_DOM1_FIRST_ENV
./hawk_DOM2_SECOND_ENV
./hawk_DOM3_THIRD_ENV
Now I need to grep the word "DOM1_FIRST_ENV","DOM2_SECOND_ENV"
like that.
I tired with cut -d "_". Its not working with any deleimiter.
Can you please help to... (3 Replies)
Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed
Bold letters are the stations . The whole file has multiple stations .
Below example i wanted to search... (4 Replies)
Hi Team
I have an huge xml where i need to search for a ceratin numbers. For example
2014-05-06 15:15:41,498 INFO WebContainer : 10 CommonServicesLogs - CleansingTriggerService.invokeCleansingService Entered PUBSUB NOTIFY MESSAGE () -
<?xml version="1.0" encoding="UTF-8"... (5 Replies)
Hello guys,
I have problem with hpux shell script. I have one big text file that contains like
SOH
bla bla bla
bla bla bla
ETX SOH
bla bla bla
ETX
SOH
bla bla bla
ETX
What I need to do is save first SOH*BLA into file1.txt, save second SOH*BLA into file2.txt and so on.... (17 Replies)
I have the logic below to look up for matches within the columns between the two files with awk.
In the if statement is where the string comparison is attempted with ==
The issue seems to be with the operands, as
1. when " '${SECTOR}' " -- double quote followed by single quote -- awk matches... (1 Reply)
Discussion started by: deadyetagain
1 Replies
LEARN ABOUT CENTOS
create_domain
CREATE DOMAIN(7) PostgreSQL 9.2.7 Documentation CREATE DOMAIN(7)NAME
CREATE_DOMAIN - define a new domain
SYNOPSIS
CREATE DOMAIN name [ AS ] data_type
[ COLLATE collation ]
[ DEFAULT expression ]
[ constraint [ ... ] ]
where constraint is:
[ CONSTRAINT constraint_name ]
{ NOT NULL | NULL | CHECK (expression) }
DESCRIPTION
CREATE DOMAIN creates a new domain. A domain is essentially a data type with optional constraints (restrictions on the allowed set of
values). The user who defines a domain becomes its owner.
If a schema name is given (for example, CREATE DOMAIN myschema.mydomain ...) then the domain is created in the specified schema. Otherwise
it is created in the current schema. The domain name must be unique among the types and domains existing in its schema.
Domains are useful for abstracting common constraints on fields into a single location for maintenance. For example, several tables might
contain email address columns, all requiring the same CHECK constraint to verify the address syntax. Define a domain rather than setting up
each table's constraint individually.
To be able to create a domain, you must have USAGE privilege on the underlying type.
PARAMETERS
name
The name (optionally schema-qualified) of a domain to be created.
data_type
The underlying data type of the domain. This can include array specifiers.
collation
An optional collation for the domain. If no collation is specified, the underlying data type's default collation is used. The
underlying type must be collatable if COLLATE is specified.
DEFAULT expression
The DEFAULT clause specifies a default value for columns of the domain data type. The value is any variable-free expression (but
subqueries are not allowed). The data type of the default expression must match the data type of the domain. If no default value is
specified, then the default value is the null value.
The default expression will be used in any insert operation that does not specify a value for the column. If a default value is defined
for a particular column, it overrides any default associated with the domain. In turn, the domain default overrides any default value
associated with the underlying data type.
CONSTRAINT constraint_name
An optional name for a constraint. If not specified, the system generates a name.
NOT NULL
Values of this domain are normally prevented from being null. However, it is still possible for a domain with this constraint to take a
null value if it is assigned a matching domain type that has become null, e.g. via a LEFT OUTER JOIN, or INSERT INTO tab (domcol)
VALUES ((SELECT domcol FROM tab WHERE false)).
NULL
Values of this domain are allowed to be null. This is the default.
This clause is only intended for compatibility with nonstandard SQL databases. Its use is discouraged in new applications.
CHECK (expression)
CHECK clauses specify integrity constraints or tests which values of the domain must satisfy. Each constraint must be an expression
producing a Boolean result. It should use the key word VALUE to refer to the value being tested.
Currently, CHECK expressions cannot contain subqueries nor refer to variables other than VALUE.
EXAMPLES
This example creates the us_postal_code data type and then uses the type in a table definition. A regular expression test is used to verify
that the value looks like a valid US postal code:
CREATE DOMAIN us_postal_code AS TEXT
CHECK(
VALUE ~ '^d{5}$'
OR VALUE ~ '^d{5}-d{4}$'
);
CREATE TABLE us_snail_addy (
address_id SERIAL PRIMARY KEY,
street1 TEXT NOT NULL,
street2 TEXT,
street3 TEXT,
city TEXT NOT NULL,
postal us_postal_code NOT NULL
);
COMPATIBILITY
The command CREATE DOMAIN conforms to the SQL standard.
SEE ALSO
ALTER DOMAIN (ALTER_DOMAIN(7)), DROP DOMAIN (DROP_DOMAIN(7))
PostgreSQL 9.2.7 2014-02-17 CREATE DOMAIN(7)