Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site bonnie.UUCP Path: utzoo!watmath!clyde!bonnie!joel From: joel@bonnie.UUCP (Joel West) Newsgroups: net.unix,net.decus Subject: emulating ".ascii" with Awk Message-ID: <684@bonnie.UUCP> Date: Fri, 10-Jan-86 11:47:23 EST Article-I.D.: bonnie.684 Posted: Fri Jan 10 11:47:23 1986 Date-Received: Fri, 10-Jan-86 23:36:28 EST Organization: CACI -- La Jolla, Calif. Lines: 26 Xref: watmath net.unix:6794 net.decus:241 I need help getting awk to print out the numeric value of a character. I've already written a csh/awk processor to convert error message text to pre-assembled strings in assembly language (it's not C, so don't tell me to use static char *). However, while this works fine for BSD, where I can .ascii "abcdef" I have been unable to get it to work for System V, where I need: .byte 97,98,99,100,101... Unfortunately, printing a character as "%d" with printf gives me a "0". What I need is one of two things: 1) Print the numeric value of an ascii character as an integer from awk(1); or 2) Be able to pipe a string to a command (say "asbyte") which has the following property: "asbyte abcd" prints "97,98,99,100" I'm running awk under BSD 4.2, if there are different versions. -- Joel West CACI, Inc. - Federal La Jolla (c/o Bell Labs, Whipanny) ihnp4!bonnie!joel