The script I am trying to use is:
cat gatk_probes.interval_list |
awk '
BEGIN{
OFS="\t";
print "#CHR\tBP1\tBP2\tID"
}
{
split($1,a,":");
chr=a[1];
if (match(chr,"chr")==0) {
chr="chr"chr
}
split(a[2],b,"-");
bp1=b[1];
bp2=bp1;
if (length(b) > 1) {
bp2=b[2]
}
print chr,bp1,bp2,NR
}' > ./EXOME.targets.reg
I am getting the error:
awk: line 1: illegal reference to array b
Is there something obviously wrong?