Linuxlab

Text: grep, sed, awk

Half of working in the terminal is pulling what you need out of text: out of logs, out of other commands' output. There are three tools worth knowing for this: grep finds lines, sed edits them, awk counts by columns. In this lesson you try all three on ready files.

The sandbox already holds ~/app.log with application records and ~/access.log with server requests.

What to understand

grep finds lines by a pattern. The pattern is a regular expression: a way to describe what to look for. error|fail means 'error or fail'.

sed is a line-by-line editor. Most often you call it for a substitution: find one piece of text and put another in its place.

Locked

The rest of this lesson is part of a paid course

You are reading the open part. Buy the course to unlock the whole lesson and its lab.

See the course