Scientific (Exponential) Notation

58 views
Skip to first unread message

mth...@yahoo.com

unread,
Jun 17, 2014, 12:21:51 PM6/17/14
to csv...@googlegroups.com
Hi,
I am using the eval function with a UNIX time value (seconds since epoch), converting it to Windows time (100 nanosecond units since Jan 1, 1601 UTC).  My challenge is that csvfix output uses scientific notation (1.30474e+017 for the current time) but the program that reads this output will not use scientific notation.
I realize that the limitation may be with Windows, but I'm still wondering if there is a csvfix switch or setting that I've missed that will output the full 18-digit result of an eval statement.
Perhaps a csvfix eval statement is not the best tool for this conversion. Is anyone aware of a command-line tool that will accept UNIX epoch and output another date format (ISO or otherwise)?
Thank you.
Message has been deleted

Neil Butterworth

unread,
Jun 18, 2014, 5:19:13 AM6/18/14
to csv...@googlegroups.com, mth...@yahoo.com
OK, you can do this with the printf command. Once you have your number in scientific format, you can convert it to an integer string like this:

      csvfix printf -fmt "%.0f"

See the printf command documentation for more details.

mth...@yahoo.com

unread,
Jun 18, 2014, 10:08:37 AM6/18/14
to csv...@googlegroups.com, mth...@yahoo.com
Wonderful, thanks for the help. Excellent tool, by the way.

Dermot Carey

unread,
Jul 7, 2016, 1:19:41 PM7/7/16
to csvfix, mth...@yahoo.com
Hi Neil, I've run into this as well on Windows. The problem is the rounding that occurs when you convert back to a whole number wtih print f.

For example:
"1644251","232217","1.87647e+006"

Becomes
1876470

Should be:
1876468

Any way around this? Thanks!
Reply all
Reply to author
Forward
0 new messages