UNIX shell script required to read two columns from xml


Login or Register to Reply

 
Thread Tools Search this Thread
# 8  
Old 1 Week Ago
Please, please, please - with your next problem, apply utmost care from the beginning, and start with the ENTIRE picture, provide sufficient info and representative data samples, and DON'T change goals!


You can pipe your above result through another awk script for creating the SQL insert statement, but irrespective of the TOINSTANCETYPE as it is not known in the result:
Code:
awk -f ... |
awk '{IX[$1]; VAL[$1,NR%2] = $2} END {for (x in IX) print "INSERT INTO", x, "values (\"" VAL[x,1] "\" , \"" VAL[x,0] "\");"}'
INSERT INTO EPIC values ("DID" , "PROJECT_NAME");
INSERT INTO SQ_EPIC values ("DID" , "PROJECT_NAME");

You could even try to implement the "insert" creation into the first awk script; this is left as an exercise to the reader.
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Read xml tags and then remove the tag using shell script RJG Shell Programming and Scripting 3 01-18-2017 06:30 AM
How to pass the parameter in xml file in UNIX shell script? Debalina Roy Shell Programming and Scripting 3 05-05-2015 11:58 AM
How to pass the parameter in xml file in UNIX shell script? Debalina Roy Shell Programming and Scripting 2 05-05-2015 08:12 AM
UNIX Shell script to work with .xml file waiting4u Shell Programming and Scripting 3 05-18-2014 02:17 AM
How to read an xml file through shell script? ramsavi Red Hat 4 05-08-2013 06:16 AM
Shell Script to read XML file SmilePlease Shell Programming and Scripting 5 04-03-2013 07:55 AM
Shell Script to read XML tags and the data within that tag SmilePlease UNIX for Advanced & Expert Users 2 04-03-2013 07:16 AM
Howto compare the columns of 2 diff tables of 2 different schemas in UNIX shell script Rajkumar Gopal Shell Programming and Scripting 2 03-27-2013 03:01 AM
Unix Script to read the XML file from Website phani333 Shell Programming and Scripting 8 02-01-2011 08:23 PM
How to send email using shell script in UNIX, Is any environment setup required in Mac OS X ? Afreen Shell Programming and Scripting 2 05-05-2010 02:13 PM
Help required on basic Unix Bourne Shell Script methopoth Shell Programming and Scripting 1 03-25-2010 05:44 AM
edit columns in unix shell script kingpeejay Shell Programming and Scripting 10 06-22-2009 08:01 PM
How to remove xml namespace from xml file using shell script? Gary1978 Shell Programming and Scripting 10 10-26-2008 09:32 PM
Shell script failing to read large Xml record-urgent critical help aixjadoo UNIX for Advanced & Expert Users 10 06-16-2008 06:22 AM
shell script required to convert rows to columns suresh3566 Shell Programming and Scripting 2 05-07-2008 05:25 AM