Join David D. Levine for an in-depth discussion in this video Exploring basic input-field separators, part of AWK Essential Training.
- View Offline
…One of awk's most fundamental concepts is that its input and…output consist of records and each record is divided into fields.…But how does awk define a record and a field?…It's actually very flexible, which is good, because you'll encounter…a wide variety of file formats in the real world.…By default, awk considers each line of its…text input to be a record, and whitespace, any…string of spaces and/or tabs, marks the end…of one field and the beginning of the next.…For example, this awk program tells awk to print the second field on each line.…
Now, if we separate our fields with a…space, one, space, two, space, three, it prints, two.…If we use a tab character, one, tab, two, tab, three, it also prints, two.…You can also use several spaces or tabs in a row.…One, space space space, two, space space space, tab, three.…Or you can use a mix of spaces and tabs.…One, space, tab, space, two, tab tab space, tab tab three.…As you may recall from the last chapter, the capital F command…line flag tells awk to use the following argument as a field separator.…
In this course, award-winning author and teacher David D. Levine shows you how to use AWK to read and write data in a variety of formats, produce reports, and automate repetitive tasks. He reviews the nuts and bolts of the language, such as field separators, pattern matching, variables, operators, expressions, and control structures; functions available for manipulating data; and integration with other programs like Excel.
- What is AWK?
- Writing an AWK program
- Working with records, fields, patterns, and actions
- Specifying field and record separators with variables
- Using built-in and user-defined variables
- Building control structures
- Formatting output
- Manipulating string data with functions
- Scripting with AWK