Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Mar 2002 01:16:23 -0500
From:      parv <parv_@yahoo.com>
To:        Mike Meyer <mwm-dated-1016613546.2a263a@mired.org>
Cc:        f-q <freebsd-questions@freebsd.org>
Subject:   Re: /usr/bin/printf & printing escaped characters
Message-ID:  <20020316061622.GA21757@moo.holy.cow>
In-Reply-To: <15505.45865.551648.353554@guru.mired.org>
References:  <20020315080839.GA18963@moo.holy.cow> <15505.45865.551648.353554@guru.mired.org>

next in thread | previous in thread | raw e-mail | index | archive | help
in message <15505.45865.551648.353554@guru.mired.org>,
wrote Mike Meyer thusly...
>
> 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
...
> > 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

thanks mike, that did it.

i would have replaced all the echo's w/ /usr/bin/printfs in my shell
scripts if that had worked like the way printf works in (g)awk; now
i find myself in no any particular hurry.

 -  parv

-- 
 

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?20020316061622.GA21757>