课程: AWK Essential Training

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Using built-in variables

Using built-in variables

- [Instructor] Although it's simpler than other languages like Pearl and Python, AWK is a fully fledged programming language and it has a full compliment of variables and operators. Although this course assumes you've had some exposure to basic programming language concepts, right now I'm going to give you a brief introduction to these concepts as they're implemented in AWK. In the previous chapter, we looked at the variables FS, RS, OFS, and ORS, which control field and record separators. These are examples of built in variables which are defined by AWK rather than by the user. You've also seen the variable NF whose value is the number of fields on the line. Related to NF is the special variable NR whose value is the record number or line number of the record that is currently being examined. So instead of the number of fields, we'll print the record number. Both of these variables can be used in patterns as well…

内容