Page 1 of 1

split a file based on column

Posted: 02 Jun 2016 02:11
by santhosh
Anyone help me on batch or awk script to give below output.

user input in run command as: sh runscript.sh test.xml test.template test.values
if any of the three argument not given it should through error like argument missing

input file contains
test.xml:
//############################################## Voice Mail System Configuration settings - STARTS ######################################################

//Voicemail Messages Storage Path - Format: file://path
var IP_Recordings="file:///vmsrecordings_new/vmsrecordings";

//Configure media file path
var audioprompt="file:///opt//tomcat7/webapps/VMS_Rev2/promptFiles/audio";

//Voicemail WebApp Context Path - Format: http://IP:PORT/ContextName
var IP="http://localhost:9090/VMS_Rev2";

//CC should exist here in MultiIMSI Country Code list also
var multiImsiCountryCode="43,49,444,31,41,21,351,1234,75,1,35,91,44,353"; // CC should exist here.

var DepositLangFlag=1;

var DepositLangFlage =2;




output file should be two files:
test.template

//############################################## Voice Mail System Configuration settings - STARTS ######################################################

//Voicemail Messages Storage Path - Format: file://path
var IP_Recordings={{ IP_Recordings}};
//Configure media file path
var audioprompt={{ audioprompt }};
//Voicemail WebApp Context Path - Format: http://IP:PORT/ContextName
var IP={{ IP }};
//CC should exist here in MultiIMSI Country Code list also
var multiImsiCountryCode={{ multiImsiCountryCode }}; // CC should exist here.

var DepositLangFlag={{ DepositLangFlag }};
var DepositLangFlage ={{ DepositLangFlage }};


second output file should be:

test.values:

IP_Recordings: "file:///vmsrecordings_new/vmsrecordings"
audioprompt: "file:///opt/tomcat7/webapps/VMS_Rev2/promptFiles/audio"
IP: "http://localhost:9090/VMS_Rev2"
multiImsiCountryCode: "43,49,444,31,41,21,351,1234,75,1,35,91,44,353"
DepositLangFlag: "1"
DepositLangFlage: "2"

Thanks
satish