Xref: utzoo comp.unix.questions:18807 comp.unix.wizards:20015 Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!ssbell!mcmi!omaha1!wcc From: wcc@omaha1.UUCP (William C Carey) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: Access to UNIX-Related Publications Summary: Awk 'printf' question Message-ID: <166@omaha1.UUCP> Date: 5 Jan 90 14:52:21 GMT References: <487@longway.TIC.COM> Organization: Computer Consoles, Inc., Omaha NE Lines: 27 Any of the luminaries out there know how to get 'awk' (not nawk) to ouput a single-quote character ( ascii 0x27 ). I can't get the 'print' or the 'printf' statement to do it with any combination of backslashes, double-quotes, or percent characters. I am trying to get a pipe line into SQL which calls for single quotes in it's string searches. I am currently using 'tr' in the next 'section-of-pipe' after awk to translate some character (ie `, backtick) into a single-quote as in: cat nofind | awk ' /^3\`/ { print char split($0,line,"`") n = split(line[2],array,"-") if ( n = 4){ printf("select * from ranges where\n") printf("addr_county = `%s*` and \n", array[1]) printf("addr_locality = `%s*` and \n", array[2]) printf("addr_st_name = `%s*` and \n", array[3]) printf("addr_thorough = `%s*` /\n", array[4]) } } ' | tr '`' '\047' | SQL This works but is not "awkward" enough( sorry about the pun).