RE: An nawk question?
Posted in 2000
Demus, Alan — — source: Informix-list mailing list archive (1991-1998)
I don' think there is a built-in way, but you can do something fairly sloppy like: nawk 'function fromhex(x, a, n, i) { n = length(x) a = 0 for (i = 1; i <= n; i++) { a = 16 * a + substr(x, i, 1) } return a } { result = fromhex(x1) + fromhex(x2) printf "%x\\n", result }' > -----Original Message----- > From: Steve Romankiw [SMTP:sromankiw@execrisk.com] > Sent: Friday, September 15, 2000 12:55 PM > To: IIUG > Subject: An nawk question? > > Using nawk, how do you do aithmetic operations using hexidecimal numbers. > > For example: > > nawk ' { > Hex_1 = "\\x1" > Hex_2 = "\\x2" > Hex_Result = Hex_1 + Hex_2 > } > > > Any thoughts? > > TIA > > Steve Romankiw > >