Nawk Script not working

Any idea why this isn't working?

 
YESTERF=`TZ=aaa24 date +%b"-"%d | sed 's/-0/--/'`
 
 
filelist2=$(find /export/home/gen/cks/traces \( -name \*YESTERF\* -name \*DNA\* \) -print | tr '\n' ' ')
 
 
print "Date/Time,Location,Shelf,IP,Reason,Log Filename" >> $OUTPUT
nawk -F':' '
$2 ~ /Reason/ && $3 !~ /(PASSTHRU|OCP|FP Power Button|Bootloader|PFR|MEM)/ {
split(FILENAME, a, "-")
f = a[1]
while (i = index(f, "/")) f = substr(f, i+1)
sub("\r$", "");
printf("%s %s,%s %s,%s,%s,%s,%s-%s-%s-%s-%s-%s-%s-%s-%s\n", a[5], a[6], a[2], a[3], a[4], f, $0, f, a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9])
}' $filelist2 >> $OUTPUT
 

The filenames that would be the input are as follows:

 
10.7.333.13-DNA-Moto33-1-Jul--6-07-29-44.txt
10.2.334.54-DNA-Moto22-1-Jul--6-05-44-32.txt

There is no output, the script just hangs and doesn't finish running.

My suspicion is that $filelist2 might be empty.
Try to echo its value before you call nawk.

And if my suspicion is correct, this is most likely the culprit:

$(find /export/home/gen/cks/traces \( -name \*YESTERF\* -name \*DNA\* \)

because your filenames dont contain the string 'YESTERF'

1 Like

Thanks! Silly mistake on my part...:smiley: