Text Processing, Regular Expressions, and JSON

11. Text Processing, Regular Expressions, and JSON#

This chapter turns Unix text tools into analysis tools for logs, command output, structured fields, and JSON data.

  • Search: Find relevant records.

  • Regex: Describe text patterns.

  • Fields: Extract columns and delimited values.

  • JSON: Use jq for structured output.

  • Counts: Summarize repeated users, IPs, and events.

Chapter Video

Linux Crash Course - The grep Command (14:57) by Learn Linux TV

Hosted on YouTube; property of its original creator, embedded here for educational reference only.

Learning Objectives

By the end of this chapter, you will be able to:

  1. Search and filter text with grep and regular expressions.

  2. Extract fields with cut, awk, and related tools.

  3. Transform text with sed and pipelines.

  4. Parse JSON with jq.

  5. Count and summarize repeated log events.

Chapter Flow

Glossary

#

Term

Explanation

1

grep

Search tool for matching lines.

2

regular expression

Pattern language for text.

3

field

Part of a record separated by a delimiter.

4

delimiter

Character separating fields.

5

awk

Field-oriented text processor.

6

sed

Stream editor.

7

sort

Tool for ordering lines.

8

uniq

Tool for adjacent duplicate lines.

9

jq

Command-line JSON processor.

10

log parsing

Extracting useful records from logs.