Awk new datetime everyline

Hi,

I'm using awk in HP-UX machine which does not support systime(), strftime(). So to get the date time I was using :

 
seq 1 100000 | awk ' "date +%Y%m%d%H%M%s" | getline curtime; print curtime }'
 

However the above code gets the date only once, next time it is not updated. For example if I clear the curtime, like :

 
seq 1 100000 | awk ' "date +%Y%m%d%H%M%s" | getline curtime; print curtime; curtime = "" }'
 

It'll print the date only once and blanks for other lines.

Is there any way I can get the current date time for everyline?

Try to close the date command instead of clearing the variable curtime, something like:

seq 1 100000 | awk '{"date +%Y%m%d%H%M%S" | getline curtime; print curtime; close("date +%Y%m%d%H%M%S")}'

@Franklin52,
Thanks for replying to both of my queries in this forum:)