Hi I'm a newbie in unix and I'm having trouble in creating a script. I want to search for a pattern '_good' and insert new lines that contains '_bad', '_med', '_fail' while also ensure that the line contains _good is removed
here some of the data
UPDATE SCHOOL SET GRADE = 'PRE_SEMESTER_1_GOOD' WHERE GRADE = 'PRE_YEARLY_GOOD';
UPDATE SCHOOL SET GRADE = 'PRE_SEMESTER_1_ELSE' WHERE GRADE = 'PRE_YEARLY_ELSE';
UPDATE SCHOOL SET GRADE = 'PRE_SEMESTER_2_GOOD' WHERE GRADE = 'PRE_MONTHLY_GOOD';
UPDATE SCHOOL SET GRADE = 'PRE_SEMESTER_2_ELSE' WHERE GRADE = 'PRE_MONTHLY_ELSE';
and the required output to be:
UPDATE SCHOOL SET GRADE = 'PRE_SEMESTER_1_BAD' WHERE GRADE = 'PRE_YEARLY_BAD';
UPDATE SCHOOL SET GRADE = 'PRE_SEMESTER_1_MED' WHERE GRADE = 'PRE_YEARLY_MED';
UPDATE SCHOOL SET GRADE = 'PRE_SEMESTER_1_FAIL' WHERE GRADE = 'PRE_YEARLY_FAIL';
UPDATE SCHOOL SET GRADE = 'PRE_SEMESTER_1_ELSE' WHERE GRADE = 'PRE_YEARLY_ELSE';
etc
I have use awk to use this but i'm stuck :
here is my code:
if anyone can help me I would be greatly appreciated. Thanx
There is a requirement that i need to replaced a pattern by another pattern in all the files in my entire file system. there are 1000s of file in the system. let the pattern is "calcuta". i have to replace this pattern by "kolkata" in all those files which contain "calcuta".
I am only able to... (12 Replies)
Hi
I am trying to look for a view name in create view statement and then replace this view name with VW_ in grants line in my ddl file .
cat dim_provider.sql | grep -i "create view" | while read f1 f2 f3 f4 f5 f6 f7 f8 f9
do
new_vw=` echo "$f3" | cut -d "." -f2... (32 Replies)
Hello, i am splitting files and sometimes the string of the pattern doesnt exist in the input file it starts for example with 00:00:01. So the output is completely desorganized, is there any way of putting a replacement string in the pattern so it will grab all the times from 00:**:** to first... (0 Replies)
I have a file file123.xml which looks like this
xmlEntry="username"="josh" <property="never_back_down">
phone="<178652>"
apn=property:address="wonderland"
xmlEntry="username"="jessica" <property="never_back_down">
phone="<178653>"
apn=property:address="wonderland"... (5 Replies)
Hi
I am having a code snippet
grant permission to all user
sts|ln|uSe|PSG
sajncht|se|Use|PPSPSG
psg|ln|use|TSPSG
sts_user.Me revoke
I need to change all occurance of use (uSe,Use,use) with USE. I am using the following sed command for this
sed 's//USE/g' s_sample.txt
Output: (7 Replies)
Hi there,
i am absolutely new in shell programming and especially using sed. What i want to do is to replace every emailaddress suffix with another. In my Testfile there is:
foo@bar.comMy attempt to replace every @<something>.<someotherthing> is:
sed 's/@+\.+/REPLACE/g' test.txt... (5 Replies)
HI Guys ,
Using UNIX ,I intend to check with correct file pattern Access_file_Record.YYYYMM in path /tmp
If the file exist in correct format come out from code .
If not found check with different file patterns for same month period YYYYMM ( Like Access_file_Record_YYYYMM.txt or... (8 Replies)
Hello Everybody,
I need a help in the below pattern matching and replacement issue
I have a file : emp.txt
21356 suresh 12/12/2012
23511 ramesh 11/06/2011
31456 biswajit 09/08/2013
53134 archan 06/02/2009
first field:- employee id, 2nd field is name and third field is date of joining
... (10 Replies)
Hi Techies,
I need a help in finding junk characters and remove them from a Datafile.
we have a file and it had crores of records like below
SGSN_MCC_MNC=01150
but sometime due to the issue with sending server we are getting some junk characters in the middle of data like below
... (6 Replies)
I'm trying to change a few programs in our environment. Basically We have hardcoded some server names and stuff, So I want some one to suggest me some UNIX gui tools that can be used to replace these..
I really don't want to deal doing this through the command line. I want to transfer the files... (3 Replies)
Discussion started by: sudden
3 Replies
LEARN ABOUT LINUX
set_transaction
SET TRANSACTION(7) SQL Commands SET TRANSACTION(7)NAME
SET TRANSACTION - set the characteristics of the current transaction
SYNOPSIS
SET TRANSACTION transaction_mode [, ...]
SET SESSION CHARACTERISTICS AS TRANSACTION transaction_mode [, ...]
where transaction_mode is one of:
ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED }
READ WRITE | READ ONLY
DESCRIPTION
The SET TRANSACTION command sets the characteristics of the current transaction. It has no effect on any subsequent transactions. SET SES-
SION CHARACTERISTICS sets the default transaction characteristics for subsequent transactions of a session. These defaults can be overrid-
den by SET TRANSACTION for an individual transaction.
The available transaction characteristics are the transaction isolation level and the transaction access mode (read/write or read-only).
The isolation level of a transaction determines what data the transaction can see when other transactions are running concurrently:
READ COMMITTED
A statement can only see rows committed before it began. This is the default.
SERIALIZABLE
All statements of the current transaction can only see rows committed before the first query or data-modification statement was exe-
cuted in this transaction.
The SQL standard defines two additional levels, READ UNCOMMITTED and REPEATABLE READ. In PostgreSQL READ UNCOMMITTED is treated as READ
COMMITTED, while REPEATABLE READ is treated as SERIALIZABLE.
The transaction isolation level cannot be changed after the first query or data-modification statement (SELECT, INSERT, DELETE, UPDATE,
FETCH, or COPY) of a transaction has been executed. See in the documentation for more information about transaction isolation and concur-
rency control.
The transaction access mode determines whether the transaction is read/write or read-only. Read/write is the default. When a transaction is
read-only, the following SQL commands are disallowed: INSERT, UPDATE, DELETE, and COPY FROM if the table they would write to is not a tem-
porary table; all CREATE, ALTER, and DROP commands; COMMENT, GRANT, REVOKE, TRUNCATE; and EXPLAIN ANALYZE and EXECUTE if the command they
would execute is among those listed. This is a high-level notion of read-only that does not prevent all writes to disk.
NOTES
If SET TRANSACTION is executed without a prior START TRANSACTION or BEGIN, it will appear to have no effect, since the transaction will
immediately end.
It is possible to dispense with SET TRANSACTION by instead specifying the desired transaction_modes in BEGIN or START TRANSACTION.
The session default transaction modes can also be set by setting the configuration parameters default_transaction_isolation and
default_transaction_read_only. (In fact SET SESSION CHARACTERISTICS is just a verbose equivalent for setting these variables with SET.)
This means the defaults can be set in the configuration file, via ALTER DATABASE, etc. Consult in the documentation for more information.
COMPATIBILITY
Both commands are defined in the SQL standard. SERIALIZABLE is the default transaction isolation level in the standard. In PostgreSQL the
default is ordinarily READ COMMITTED, but you can change it as mentioned above. Because of lack of predicate locking, the SERIALIZABLE
level is not truly serializable. See in the documentation for details.
In the SQL standard, there is one other transaction characteristic that can be set with these commands: the size of the diagnostics area.
This concept is specific to embedded SQL, and therefore is not implemented in the PostgreSQL server.
The SQL standard requires commas between successive transaction_modes, but for historical reasons PostgreSQL allows the commas to be omit-
ted.
SQL - Language Statements 2010-05-14 SET TRANSACTION(7)