| Title: | Welcome to Korn_Shell_Programming |
| Moderator: | PLUGH::needle |
| Created: | Tue Jun 25 1991 |
| Last Modified: | Fri May 30 1997 |
| Last Successful Update: | Fri Jun 06 1997 |
| Number of topics: | 118 |
| Total number of notes: | 426 |
Hi. Is there a printf function in ksh? Basically I would like to be able to format output with more flexibility than simply using tabs with echo. Something like the C function printf would be excellent. Thanks for any information. [Posted by WWW Notes gateway]
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 115.1 | SPECXN::DERAMO | Dan D'Eramo | Thu May 01 1997 11:24 | 16 | |
The command
$ man ksh | col -bh | grep -i printf
doesn't show anything. I know awk has a built-in printf and
surely perl must have one as well. At worst you can try to
figure out how to properly quote something like
$ awk 'BEGIN { printf "%-6d %4s %3d\n", 3, "ab", 12 }' < /dev/null
3 ab 12
so that the variables holding the values 3, "ab", and 12 get
expanded properly.
Dan
| |||||
| 115.2 | NNTPD::"[email protected]" | Janice Chang | Fri May 02 1997 10:57 | 5 | |
Thanks. I am now using awk, and it is quite powerful for what I need. [Posted by WWW Notes gateway] | |||||
| 115.3 | WRLDYD::BOURQUE | Fri May 02 1997 23:21 | 12 | ||
New versions of korn shell has the printf capabiliity, unfortunately, the
version released with digital unix does not have it
<<< Note 115.2 by NNTPD::"[email protected]" "Janice Chang" >>>
Thanks. I am now using awk, and it is quite powerful for what I need.
[Posted by WWW Notes gateway]
| |||||
| 115.4 | /usr/bin/printf | SAPEC3::WALLMEROTH | Mon May 05 1997 04:10 | 2 | |
at least since V3.2C 'type printf' gives you 'usr/bin/printf' and
'man printf' shows a chapter 1 manpage.
| |||||
| 115.5 | SPECXN::DERAMO | Dan D'Eramo | Thu May 08 1997 15:36 | 7 | |
Neat! In fact at least since "V3.0 347" there has been
a /usr/bin/printf ...
pinkft> uname -a
OSF1 pinkft.cxo.dec.com V3.0 347 alpha
Dan
| |||||