Sep 21, 2005 #1 Mag0007 MIS Feb 15, 2005 829 US Is it possible to get a stricter awk format with printf? I am having problems if my %s is very large, and it messes up my whole line. for example I have something like this. printf("%s\t\t\t%s*%s"megabytes"\t\t\t\t%d \n",$3,$27,$12,$27*$12) TIA!
Is it possible to get a stricter awk format with printf? I am having problems if my %s is very large, and it messes up my whole line. for example I have something like this. printf("%s\t\t\t%s*%s"megabytes"\t\t\t\t%d \n",$3,$27,$12,$27*$12) TIA!
Sep 21, 2005 1 #2 PHV MIS Nov 8, 2002 53,708 FR To lilit to 70 chars: %-70.70s Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
To lilit to 70 chars: %-70.70s Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
Sep 21, 2005 Thread starter #3 Mag0007 MIS Feb 15, 2005 829 US thanks for the reply PHV. I guess i am looking more for a spredsheet type solution on my cells. I am trying to build a table, but values are keep getting mangles because some fields are large and some are small. I need consistency Upvote 0 Downvote
thanks for the reply PHV. I guess i am looking more for a spredsheet type solution on my cells. I am trying to build a table, but values are keep getting mangles because some fields are large and some are small. I need consistency
Sep 21, 2005 #4 PHV MIS Nov 8, 2002 53,708 FR The %-X.Xs format force the width to exactly X characters. Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
The %-X.Xs format force the width to exactly X characters. Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
Sep 21, 2005 Thread starter #5 Mag0007 MIS Feb 15, 2005 829 US PHV: Hmm I am trying it... I was playing with that, and now I think I think what the issue is. printf("%.11s \t\t\t\t\t %.4s * %.4s \t\t\t\t %8.0f \n",$3,$27,$12,$27*$12) The $3 variable max size gets to be 11, so I capped it off at 11, but I can't seem to control $27, $12 and $27*$12 to be in the same place... Upvote 0 Downvote
PHV: Hmm I am trying it... I was playing with that, and now I think I think what the issue is. printf("%.11s \t\t\t\t\t %.4s * %.4s \t\t\t\t %8.0f \n",$3,$27,$12,$27*$12) The $3 variable max size gets to be 11, so I capped it off at 11, but I can't seem to control $27, $12 and $27*$12 to be in the same place...
Sep 21, 2005 #6 PHV MIS Nov 8, 2002 53,708 FR And this ? printf("%-11.11s \t\t\t\t\t %-4.4s * %-4.4s \t\t\t\t %8.0f \n",$3,$27,$12,$27*$12) Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
And this ? printf("%-11.11s \t\t\t\t\t %-4.4s * %-4.4s \t\t\t\t %8.0f \n",$3,$27,$12,$27*$12) Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886