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
jqfor 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:
Search and filter text with
grepand regular expressions.Extract fields with
cut,awk, and related tools.Transform text with
sedand pipelines.Parse JSON with
jq.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. |