Printf (Unix)
Encyclopedia
printf shell builtin command (and utility program) accepts a format string, which specifies methods for formatting items and a list of items to be formatted. Named for the intention of printing to a printer, it actually outputs to STDOUT. Characters in the format string are copied to the output or, if a % is encountered, are used to format an item.
In addition to the standard formats, %b causes printf to expand backslash escape sequences ( for example \n for newline) and %q outputs an item that can be used as shell input.
The format string is reused if there are more items then format specs.
Unused format specs are provide a zero value or null string.

See printf
Printf
Printf format string refers to a control parameter used by a class of functions typically associated with some types of programming languages. The format string specifies a method for rendering an arbitrary number of varied data type parameter into a string...

 function for more details.

Example:

for NUMBER in 4 6 8 9 10
do printf " >> %03d %d<< \n" $NUMBER $RANDOM
done
>> 004 26305<<
>> 006 6687<<
>> 008 20170<<
>> 009 28322<<
>> 010 4400<<

example output of usage from bash builtin
printf: usage: printf [-v var] format [arguments]

example output of usage from printf utility
usage: printf format [arguments ...]

Printf
Printf
Printf format string refers to a control parameter used by a class of functions typically associated with some types of programming languages. The format string specifies a method for rendering an arbitrary number of varied data type parameter into a string...

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK