Mission 147

Awk reports

Build a small report from fields.

Shell scripting
8 minutes Advanced Lesson 147 of 360
awktee
Lesson 147 of 360 0/360 lessons 0/17 missions Shell scripting · 8 minutes
0%
Continue View profile
Ops lab terminal Training lab
New learnerrank 0XP 0%complete
learner@clairos:/home/learner $ Unix ops lab: type a command, press Enter
Instructions 8 minutes

Click any instruction for the command details, the why, and the common mistake to avoid.

Capture auth process fields

Run awk '{print $5}' /var/log/auth.log | tee lab/auth-processes.txt.

awk '{print $5}' /var/log/auth.log | tee lab/auth-processes.txt
Read report

Run cat lab/auth-processes.txt.

cat lab/auth-processes.txt
Count report

Run wc -l lab/auth-processes.txt.

wc -l lab/auth-processes.txt
Lesson support

What to notice while you play.

Objective

Build a small report from fields.

Hint

Run the commands in order and compare the outputs.

Why it matters

Junior operators build confidence by gathering evidence before changing systems.

Common mistakes
  • Skipping the inspection step.
  • Assuming one command tells the whole story.
Reference

Commands in this lesson.

awk '{print $N}' <file>

Print a whitespace-delimited field.

tee <file>

Write piped text to a lab file and keep it on screen.