diff --git a/doc_src/cmds/printf.rst b/doc_src/cmds/printf.rst index d42acf825..aa6471da2 100644 --- a/doc_src/cmds/printf.rst +++ b/doc_src/cmds/printf.rst @@ -44,6 +44,8 @@ Valid format specifiers are taken from the C library function ``printf(3)``: Conversion can fail, e.g. "102.234" can't losslessly convert to an integer, causing printf to print an error. If you are okay with losing information, silence errors with `2>/dev/null`. +A number between the ``%`` and the format letter specifies the width. The result will be left-padded with spaces. + Backslash Escapes ----------------- printf also knows a number of backslash escapes: diff --git a/doc_src/cmds/string-pad.rst b/doc_src/cmds/string-pad.rst index 8f2492715..ee83386ef 100644 --- a/doc_src/cmds/string-pad.rst +++ b/doc_src/cmds/string-pad.rst @@ -34,17 +34,22 @@ Examples :: - >_ string pad -w 10 abc + >_ string pad -w 10 abc abcdef abc + abcdef >_ string pad --right --char=🐟 "fish are pretty" "rich. " fish are pretty rich. 🐟🐟🐟🐟 - >_ string pad -w 6 -c- " | " "|||" " | " | string pad -r -w 9 -c- - --- | --- - ---|||--- - --- | --- + >_ string pad -w$COLUMNS (date) + # Prints the current time on the right edge of the screen. + +See Also +-------- + +- The :ref:`printf ` command can do simple padding, for example ``printf %10s\n`` works like ``string pad -w10``. + .. END EXAMPLES