Printf, the output function of awk in AIX

Source: Internet
Author: User


Printf [plain] www.2cto.com output function printf: printf ([format_control_flg], arg) printf modifier-left aligned Width field step, 0 indicates 0 step size. the maximum length of the prec string, or the number of digits on the left of the decimal point ------------------------------ printf format: % c ASCII character % d integer % e floating point, scientific notation, such as: 12.3 × 10e4% f floating point: 123.45% g awk decides which floating point number to use to convert e or f % o octal number % s string % x hexadecimal -------------------------------------------------- 1. character conversion echo "65" | awk '{printf "% c \ n ", $0} 'a awk' BEGIN {printf "% c # % c \ n", 92,93, 94,95, 96,97} '\] ^ _' # a awk 'BEGIN {printf "% f \ n", 0} '2017 awk' BEGIN {printf "% f \ n ", 1.0215} '192. formatting output prints formatted data row by row: awk '{printf "%-15 s % s \ n", $1, $3}' grade.txt M. tansley 48311 J. lulu 48317 P. bunny 48 J. troll 4842 L. tansley 4712 awk 'in in {printf "Name \ t \ tS. number \ n "}{ printf" %-15 s % s \ n ", $1, $3} 'grade.txt Name S. number M. tansley 48311 J. lulu 48317 P. bunny 48 J. troll 4842 L. tansley 4712 3. pass the value awk command variable = input value awk '{if ($5 <AGE) print $0}' AGE = 10 grade.txt M. tansley 05/99 48311 Green 8 40 44 J. lulu 06/99 48317 green 9 24 26 [plain] string shielding sequence ----------------------------- \ B Return key \ f go to paper feed \ n line feed \ r return key \ r tab key \ ddd eight character \ c any other character --------------------------- awk 'in in {print "May \ tDay \ n \ nMay \ 104 \ 141 \ 171"} 'May Day May Day \ 104: d's octal ASCII Code \ 141: a's octal ASCII Code \ 171: y's octal ASCII code -- the end --

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.