I have been trying to work this out for three days now. I have two files involved.
master_sorted
pre_build_out_a#
I need to use the number at the end of the first pre_build_out_a# file, use that number to find that line number in the master_sorted file, and replace the text SITE_NUMBER in the pre_build_out_a# and output to pre_build_out_b# (# being the same number as in the original pre_build file)
It should keep processing files until it has completed all the prebuild files seperatly.
This is what I have so far, but it doesn't work.
BEGIN { FS =",";fn1="master_sorted"}
{
num = $5
fn2 = "pre_sorted_out_b" substr(FILENAME, MATCH(FILENAME "[0-9]+")
while ((getline < fn1 ) > 0) {
gsub (/SITE_NUMBER/,num)
print > fn2
}
close(fn1)
close(fn2)
}
Contents of master_sorted:
11,11,152,223,B00222
16,16,116,23,B00056
296,96,132,10,B00332
Contents of pre_build_out_a1:
RXMOI:MO=RXOTG-152,COMB=HYB,RSITE=SITE_NUMBER,SWVER=B0531R0702;
RXESI:MO=RXOTG-152;
RXBLE:MO=RXOTG-152;
RXMOI:MO=RXOCF-152,TEI=TG_TEI;
RXMOC:MO=RXOCF-152,SIG=CONC;
RXMOI:MO=RXOIS-152;
RXMOI:MO=RXOTF-152,TFMODE=SA;
RXMOI:MO=RXOCON-152,DCP=64&&87;
DTBLEIP=T1_NUMBER;
EXDAIEV=DEVICE_RANGE;
BLODEEV=DEVICE_RANGE;
RXAPI:MO=RXOTG-152,DEV=DEVICE_RANGE,DCP=T1_DCPS;
master_sorted
pre_build_out_a#
I need to use the number at the end of the first pre_build_out_a# file, use that number to find that line number in the master_sorted file, and replace the text SITE_NUMBER in the pre_build_out_a# and output to pre_build_out_b# (# being the same number as in the original pre_build file)
It should keep processing files until it has completed all the prebuild files seperatly.
This is what I have so far, but it doesn't work.
BEGIN { FS =",";fn1="master_sorted"}
{
num = $5
fn2 = "pre_sorted_out_b" substr(FILENAME, MATCH(FILENAME "[0-9]+")
while ((getline < fn1 ) > 0) {
gsub (/SITE_NUMBER/,num)
print > fn2
}
close(fn1)
close(fn2)
}
Contents of master_sorted:
11,11,152,223,B00222
16,16,116,23,B00056
296,96,132,10,B00332
Contents of pre_build_out_a1:
RXMOI:MO=RXOTG-152,COMB=HYB,RSITE=SITE_NUMBER,SWVER=B0531R0702;
RXESI:MO=RXOTG-152;
RXBLE:MO=RXOTG-152;
RXMOI:MO=RXOCF-152,TEI=TG_TEI;
RXMOC:MO=RXOCF-152,SIG=CONC;
RXMOI:MO=RXOIS-152;
RXMOI:MO=RXOTF-152,TFMODE=SA;
RXMOI:MO=RXOCON-152,DCP=64&&87;
DTBLEIP=T1_NUMBER;
EXDAIEV=DEVICE_RANGE;
BLODEEV=DEVICE_RANGE;
RXAPI:MO=RXOTG-152,DEV=DEVICE_RANGE,DCP=T1_DCPS;