25 lines
521 B
Python
Executable File
25 lines
521 B
Python
Executable File
#! /usr/bin/env python3
|
|
#
|
|
# Convert large integers in the to-bytes.awk output to floating point
|
|
# exponential format, because some versions of awk output large integers in
|
|
# that format.
|
|
|
|
import sys
|
|
|
|
bignumber = 2**31 - 1
|
|
|
|
for line in sys.stdin:
|
|
outstr = ""
|
|
for field in line.split():
|
|
try:
|
|
num = float(field)
|
|
except ValueError:
|
|
num = 0
|
|
|
|
if num > bignumber:
|
|
outstr += f"{num:.5e} "
|
|
else:
|
|
outstr += f"{field} "
|
|
|
|
print(outstr[:-1])
|