From the course: Linux Bash Shells and Scripts: Streamlining Tasks and Enhancing Workflows with Automation

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Using AWK

Using AWK

- [Instructor] The AWK language. AWK is another filter, essentially, but it's more of a programming language. So you can do all sort of kind of algorithmic things. AWK, by the way, is named after three people. They had changed the order of their names, it could have been a WAK language. So I use AWK when I've got kind of more complicated things to do, or maybe generate some sort of kind of report-based thing. Based on the output of commands or what's in files. So AWK does process a line at a time, and then you could do stuff with that, including kind of keeping track of what's happened. Like, summing stuff up is common to use an AWK. AWK breaks up the line into fields, where fields are usually things separated by white space and it calls the first field $1, second, $2, and so forth. So it can be real convenient, right? So the fields are delimited by what's in the variable FS, for field separator. Normally, that's white spaces and tabs. If you want to, say, print out the whole line for…

Contents