Home > Archive > AWK > December 2004 > save formatted output from printf into variable
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
save formatted output from printf into variable
|
|
| championsleeper 2004-12-03, 3:56 pm |
| 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
| |
| Ed Morton 2004-12-03, 3:56 pm |
|
championsleeper wrote:
> 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?
Use sprintf to format the string, then printf to print it.
Ed.
> awk newbie
| |
| championsleeper 2004-12-07, 3:59 am |
| Ed Morton <morton@lsupcaemnt.com> wrote in message news:<coiae7$cma@netnews.proxy.lucent.com>...[color=darkred]
> 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.
|
|
|
|
|