Is there any way to obtain Unix Time with nanoseconds with strftime in bash?
My line for unix time :
<command> | awk '{ print strftime("%s"), $0; }'
I cannot use date +%N because date is only evaluated once.
Is there any work around?
I found a workaround using while read. date gets updated that way. No need for strftime.
<command> | while read line; do d=`date +%s%N`; echo $d $line; done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With