From the course: Bash Patterns and Regular Expressions
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Using regexes in AWK - Bash Tutorial
From the course: Bash Patterns and Regular Expressions
Using regexes in AWK
- [Instructor] Awk is a special purpose programming language designed for text processing and typically used as a data extraction and reporting tool. You can write complete programs in awk. Since this course focuses on pattern matching regular expressions we'll use regex as an awk in this video. Awk uses EREs only. There is no option for using BREs. The easiest use of awk with regular expressions is to operate on a file, search for lines that match, and then do something. I've included a file in chapter eight directory of the exercise files. Because awk is an entire programming language and not just a tool to search files or edit text, like grep and sed, it's a struggle to constrain the conversation of using regexes with awk. However, the simplest form is this, in the chapter eight directory type in awk, space, dash, capital F, double quote, colon, double quote, space, single quote, forward slash, caret, root, forward slash; that's the pattern we're matching; left curly bracket…
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.