commands:builtin:printf

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
commands:builtin:printf [2016/11/30 15:34]
medievalist Replace incorrect information about awk
commands:builtin:printf [2016/11/30 15:39] (current)
medievalist [differences from awk printf]
Line 277: Line 277:
 Please read the manpage of ''​strftime(3)''​ to get more information about the supported formats. Please read the manpage of ''​strftime(3)''​ to get more information about the supported formats.
  
-==== differences from awk printf ====+===== differences from awk printf ​=====
  
-Awk also derives its //​printf()//​ function from C, and therefore has similar format specifiers. ​ However, in all versions of awk the space character is used as a string concatenation operator, so it cannot be used as an argument separator. ​ **Arguments to awk printf must be separated by commas.**  ​Most versions of awk do not require printf arguments to be surrounded by parentheses,​ but you should use them anyway ​for portability.+Awk also derives its //​printf()//​ function from C, and therefore has similar format specifiers. ​ However, in all versions of awk the space character is used as a string concatenation operator, so it cannot be used as an argument separator. ​ **Arguments to awk printf must be separated by commas.**  ​Some versions of awk do not require printf arguments to be surrounded by parentheses,​ but you should use them anyway ​to provide ​portability.
  
-In the following example, the two strings are catenated ​so that no argument remains to fill the format.+In the following example, the two strings are concatenated by the intervening space so that no argument remains to fill the format.
  
 <​code>​ <​code>​
Line 300: Line 300:
 </​code>​ </​code>​
  
-Of course, ​the bash printf can be called from inside awk (as from perl and other languages that support shell callout) as long as you don't care about program efficiency ​and readability.+With appropriate metacharacter escaping ​the bash printf can be called from inside awk (as from perl and other languages that support shell callout) as long as you don't care about program efficiency ​or readability.
  
 <​code>​ <​code>​
  • commands/builtin/printf.1480520052.txt
  • Last modified: 2016/11/30 15:34
  • by medievalist