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 - Linux Tutorial
From the course: Linux Bash Shells and Scripts: Streamlining Tasks and Enhancing Workflows with Automation
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Defining filters and using head, tail, and wc3m 18s
-
(Locked)
The use of sed for powerful scripting5m 55s
-
(Locked)
Using AWK5m 22s
-
(Locked)
Positional parameters and curly braces for variables3m 40s
-
(Locked)
Shell parameter expansion3m 47s
-
(Locked)
Challenge: Looping and special variable operators1m 12s
-
(Locked)
Solution: Looping and special variable operators2m 23s
-
(Locked)
Challenge: sed and AWK1m 33s
-
(Locked)
Solution: sed and AWK3m 17s
-
-
-