[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#534242: ITP: antihex -- Converts hex to decimal



Hi,

Harry Rickards wrote:
  Section         : math

AntiHex is a pipe to convert hex values into decimal. Ex: # cat
/proc/iomem 00000000-0009fbff : System RAM 0009fc00-0009ffff : reserved
.... # cat /proc/iomem | ah 00000000-639K-1 : System RAM 639K -640K-1 :
reserved ...

I'm not sure the equivalent of

python -c 'import re,sys ; exec("""for l in sys.stdin: \
sys.stdout.write(re.sub(r"(?<![0-9A-Fa-f])[0-9A-Fa-f]{3,8}(?![0-9A-Fa-f])",\
lambda x: ((lambda y: (y>2**30 and ("%.2f"%(y/2.0**30))+"G") or \
(y>2**20 and ("%.2f"%(y/2.0**20))+"M") or (y>2**10 and \
("%.2f"%(y/2.0**10))+"K") or str(y))(int(x.group(),16))),l))""")'

qualifies as "math". And yes, I know that ah is much superior because it has the "-1" business.

Kind regards

T.
--
Thomas Viehmann, http://thomas.viehmann.net/


Reply to: