课程: AWK Essential Training

今天就学习课程吧!

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

Using AWK command line flags

Using AWK command line flags

- [Instructor] AWK accepts a small number of flags which are command line arguments, beginning with a dash on the command line to control its behavior. The F flag specifies that the following argument is the name of a file that contains an AWK program. For example the file swap contains the same basic AWK program we used in our very first example which prints the second field followed by the first. However, note that it is not enclosed in single quotes. We don't need to protect it from the shell because it's already inside a file. We'll use the F flag to tell AWK to execute this program. On the file names.text. As you see this had the same result as the command AWK print dollar two dollar one. You can use either the F flag or an AWK program on the command line. In fact, you must use one or the other, but not both. You would typically use the F flag rather than typing the program on the command line. If the program is long…

内容