# ksh scripting sprintf

**URL:** <https://community.unix.com/t/ksh-scripting-sprintf/162988>\
**Category:** Shell Programming and Scripting\
**Created:** [July 4, 2006, 2:47am UTC](https://community.unix.com/t/ksh-scripting-sprintf/162988 "2006-07-04T02:47:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gfhgfnhhn](https://community.unix.com/letter_avatar/gfhgfnhhn/32/6_449c533f586939b6e5f246632a46421f.png) [@gfhgfnhhn](https://community.unix.com/u/gfhgfnhhn)\
**Post date:** [July 4, 2006, 2:47am UTC](https://community.unix.com/t/ksh-scripting-sprintf/162988/1 "2006-07-04T02:47:33Z")

</div>

is there any sprintf function  
in korn shell scripting,  
or anything similar to sprintf?

---

<div class="post-metadata">

**Author:** ![thestevew](https://community.unix.com/letter_avatar/thestevew/32/6_449c533f586939b6e5f246632a46421f.png) [@thestevew](https://community.unix.com/u/thestevew)\
**Post date:** [July 4, 2006, 8:49am UTC](https://community.unix.com/t/ksh-scripting-sprintf/162988/2 "2006-07-04T08:49:24Z")

</div>

Look at printf ('man printf' for details)

---

<div class="post-metadata">

**Author:** ![jim\_mcnamara](https://community.unix.com/letter_avatar/jim_mcnamara/32/6_449c533f586939b6e5f246632a46421f.png) [@jim\_mcnamara](https://community.unix.com/u/jim_mcnamara)\
**Post date:** [July 5, 2006, 8:11am UTC](https://community.unix.com/t/ksh-scripting-sprintf/162988/3 "2006-07-05T08:11:38Z")

</div>

Then use printf like this:

```nohighlight
var=13.165
newvar=$(printf "%.0f" $var)

```
