Linux command detailed-printf

Source: Internet
Author: User

The printf command formats and outputs the results to standard output.

1 . Command format:

printf (options) (parameters)

2 . Command function:

Echo will send the input string to standard output. The output strings are separated by white space characters, and a newline number is added at the end.

3 . Command parameters:

Format alternates

%b???????????? The corresponding parameter is treated as a string containing the escape sequence to be processed.

%c???????????? ASCII characters. Display the first character of a relative parameter

%d,%i???????? Decimal integer

%e,%e,%f???? Floating-point format

%g%e or%f???? Convert, see which one is shorter, then delete the end of the 0

%G%e or%f???? Convert, see which one is shorter, then delete the end of the 0

%o???????????? Octal value with unsigned sign

%s???????????? String

%u???????????? Decimal value with no sign

%x???????????? Unsigned hexadecimal value, using a to F for 10 to 15

%x???????????? Unsigned hexadecimal value, using a to F for 10 to 15

%% ???????????? Literal meaning of the%

?

Escape sequences

\a???????????? A warning character, usually an ASCII bel character

\b???????????? Back off

\c???????????? Suppresses (does not display) the newline character at any end of the output (only valid in the parameter string under the control of the%b format designator), and any characters left in the argument, any subsequent arguments, and any characters left in the format string are ignored

\f???????????? Page Change (formfeed)

\ n???????????? Line break

\ r???????????? Enter (carriage return)

\ t???????????? Horizontal tab

\v???????????? Vertical tab

\\ ???????????? A literal backslash character

\DDD???????? A character representing a 1 to 3-digit octal value that is valid only in a format string

\0DDD???????? Represents octal value characters from 1 to 3 bits

4 . Usage Examples:

?

Linux command detailed-printf

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.