今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Formatting output with width and precision specifiers - Linux教程
课程: AWK Essential Training
Formatting output with width and precision specifiers
- [Instructor] As you see here, using tab characters produces a pretty reasonably formatted output, but not all of the columns line-up. Dominque Dickerson's name and Josephine Darakjy's are too long to fit in the first tab stop. And some of the email addresses are also longer than some of the others. In order to produce a nicely formatted output on the screen, we can use a width value with each format specifier rather than using tabs. So, I'm going to remove the 'backslash T's, instead putting in a single space. And then I'll add a number between the percent sign and the following 'S'. So I'll make the first field 20 characters wide and the second one 30. And then for the 'D', I'll use a width specifier of '3'. The width value for a format specifier is a number that goes between the percent sign and the following letter and specifies the minimum number of characters used to display the value. If a value is shorter than…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。