I have a data gathering device which records per second. Sometimes, randomly it drops a second or more. For example
166,1.09424,240,76,132
168,1.10088,215,76,132
169,1.10765,213,78,131
170,1.11458,198,79,131
It can gather 1M data points in a session, and might miss >100
Looking around I found this AWK command
awk '{ while (NR + shift < $1) { print (NR + shift) " NA"; shift++ }; print } END { shift++; while (NR + shift < 13) { print (NR + shift) " NA"; shift++ } }' /tmp/test1
from this answer
but that gives new lines when they aren't needed:
166 NA
167 NA
168 NA
169 NA
170 NA
What am I doing wrong?