在 batch 底下使用 awk 的 printf

In some reason, I have to move my job from unix to environment under windows .

But I have met some troubles. It is conflicted of "%" between batch and printf of awk.

if you type

echo 100.33 | gawk "{ printf( \"%6.2f\", $1 ) }"

it will output

.2f

you should repeat them twice like this

echo 100.33 | gawk "{ printf( \"%%6.2f\", $1 ) }"

and it will be what you want

100.33

reference
How can I use the percent symbol (%) in a batch file?
DOS Command Index

相關文章

  1. Do you feel like I feel
  2. 旋木
  3. 14
  4. 作戰
  5. 環保廣告