Date: Fri, 15 Mar 2002 02:39:05 -0600 From: "Mike Meyer" <mwm-dated-1016613546.2a263a@mired.org> To: parv <parv_@yahoo.com> Cc: f-q <freebsd-questions@freebsd.org> Subject: Re: /usr/bin/printf & printing escaped characters Message-ID: <15505.45865.551648.353554@guru.mired.org> In-Reply-To: <20020315080839.GA18963@moo.holy.cow> References: <20020315080839.GA18963@moo.holy.cow>
next in thread | previous in thread | raw e-mail | index | archive | help
In <20020315080839.GA18963@moo.holy.cow>, parv <parv_@yahoo.com> 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 <bell> character. > \b Write a <backspace> character. > \f Write a <form-feed> character. > \n Write a <new-line> character. > \r Write a <carriage return> character. > \t Write a <tab> character. > \v Write a <vertical tab> character. > \' Write a <single quote> 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 <mike -- Mike Meyer <mwm@mired.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15505.45865.551648.353554>