Code Comments
Programming Forum and web based access to our favorite programming groups.I have a printf statement that formats the output of my variables like below
:
printf("%-20s%-20s%-18s%-1s%-8s%-30s%-3s%-5s\n",aa,bb,cc,dd,ee,ff,gg,hh)
i would like to store this formatted output in the variable string. i.e.
print string
should give the same as
printf("%-20s%-20s%-18s%-1s%-8s%-30s%-3s%-5s\n",aa,bb,cc,dd,ee,ff,gg,hh)
any ideas?
awk newbie
Post Follow-up to this message
championsleeper wrote:
> I have a printf statement that formats the output of my variables like bel
ow:
>
> printf("%-20s%-20s%-18s%-1s%-8s%-30s%-3s%-5s\n",aa,bb,cc,dd,ee,ff,gg,hh)
>
> i would like to store this formatted output in the variable string. i.e.
>
> print string
>
> should give the same as
>
> printf("%-20s%-20s%-18s%-1s%-8s%-30s%-3s%-5s\n",aa,bb,cc,dd,ee,ff,gg,hh)
>
> any ideas?
Use sprintf to format the string, then printf to print it.
Ed.
> awk newbie
Post Follow-up to this messageEd Morton <morton@lsupcaemnt.com> wrote in message news:<coiae7$cma@netnews.proxy.lucent.co m>... > championsleeper wrote: > > > Use sprintf to format the string, then printf to print it. > > Ed. > hi ed, thanks very much! show's how much of a newbie i am.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.