In awk what is the difference between print and printf?
Is there any restrictions to use only print instead of printf and vice-versa
As the GNU awk (gawk manual says) at http://www.gnu.org/software/gawk/manual/gawk.html#Printing
Use the print statement to produce output with simple, standardized formatting. You specify only the strings or numbers to print, in a list separated by commas. They are output, separated by single spaces, followed by a newline.
& etc.
For more precise control over the output format than what is provided by print, use printf. With printf you can specify the width to use for each item, as well as various formatting choices for numbers (such as what output base to use, whether to print an exponent, whether to print a sign, and how many digits to print after the decimal point).
So this pretty much explains the differences and restrictions.
print:
printf:
The "printf()" (formatted print) function is much more flexible, and trickier. It has the syntax:
printf(<string>,<expression list>)
Difference:
The difference between printf and print is the format argument. This is an expression whose value is taken as a string; it specifies how to output each of the other arguments. It is called the format string.
awkmanpage." Can we judge what might be hard or easy for someone else?