Changing Files with awk

While sed is line-oriented and lets you fiddle and diddle to your heart’s content, awk is field-oriented and is ideal for manipulating database or comma-delimited files. For example, if you have an address book file, you can use awk to find and change information in fields you specify, as in Code Listing 6.11. In the following steps, we’ll show you a sampling of the things you can do using awk to modify, in this example, an address book file.

Code Listing 6.11. awk lets you access individual fields in a file.
[ejr@hobbes manipulate]$ awk '{ print $1 }'address.book
Schmidt,
Feldman,
Brown,
Smith,
Jones,
[ejr@hobbes manipulate]$

To change files with awk:

De-what?

A delimited file uses a specific character to show ...

Get Unix Third Edition: Visual Quickstart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.