Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Convert Update statement into Insert statement in UNIX using awk, sed....

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 03-22-2016   -   Original Discussion by dev123
dev123 dev123 is offline
Registered User
 
Join Date: Mar 2016
Last Activity: 22 March 2016, 11:07 AM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Hammer & Screwdriver Convert Update statement into Insert statement in UNIX using awk, sed....

Hi folks,

I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.

I have a bunch of update statements with all columns in a file which I need to convert into insert statements.

UPDATE TABLE_A SET COL1=1 WHERE COL2 is NULL AND COL2=3;

OUTPUT Should be:

INSERT INTO TABLE_A (COL1,COL2,COL3) VALUES (1,NULL,3);

Many Thanks.

Last edited by dev123; 03-22-2016 at 12:07 PM..
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Can we convert 3 awk statements in a single statement Priti2277 Shell Programming and Scripting 2 10-21-2015 04:06 PM
How is use sselect statement o/p in insert statement. nkosaraju Shell Programming and Scripting 2 08-06-2008 10:26 PM
How to convert unix command into Awk statement krishna_gnv Shell Programming and Scripting 1 05-20-2008 11:58 AM
(sed) parsing insert statement column that crosses multiple lines jjordan Shell Programming and Scripting 3 10-09-2007 01:23 AM
awk command for INSERT statement nattynatty Shell Programming and Scripting 4 05-10-2002 03:11 PM



All times are GMT -4. The time now is 05:06 AM.