From owner-freebsd-questions Fri Mar 15 0:39:14 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mired.org (dsl-64-192-6-133.telocity.com [64.192.6.133]) by hub.freebsd.org (Postfix) with SMTP id D8CB837B400 for ; Fri, 15 Mar 2002 00:39:06 -0800 (PST) Received: (qmail 64994 invoked by uid 100); 15 Mar 2002 08:39:06 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15505.45865.551648.353554@guru.mired.org> Date: Fri, 15 Mar 2002 02:39:05 -0600 To: parv Cc: f-q Subject: Re: /usr/bin/printf & printing escaped characters In-Reply-To: <20020315080839.GA18963@moo.holy.cow> References: <20020315080839.GA18963@moo.holy.cow> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ From: "Mike Meyer" X-Delivery-Agent: TMDA/0.48 (Python 2.2 on freebsd4) Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In <20020315080839.GA18963@moo.holy.cow>, parv typed: > i was trying to print escaped characters (\n & \t), but couldn't... > > # /usr/bin/printf %s "\tpolka dot\n" > \tpolka dot\n > > ...despite having listed in the man page... > > Character escape sequences are in backslash notation as defined in the > ANSI X3.159-1989 (``ANSI C''). The characters and their meanings are as > follows: > > \a Write a character. > \b Write a character. > \f Write a character. > \n Write a character. > \r Write a character. > \t Write a character. > \v Write a character. > \' Write a character. > \\ Write a backslash character. > \num Write an 8-bit character whose ASCII value is the 1-, 2-, > or 3-digit octal number num. > > ...i didn't see anything else in there. what am i missing? That you can't escape characters in a string brought in via %s? Putting the \n & \t in the format works fine for me. guru% printf "\t%s\n" "polka dot" polka dot http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message