Objective

Hands-on practice with sed & awk in a Linux environment.

Tools & Technologies

  • sed
  • awk
  • cut

Key Commands

sed -i 's/old/new/g' file.txt
awk '{print $1, $3}' file
awk -F: '{print $1}' /etc/passwd
cut -d',' -f2 data.csv

Lab Steps

01
sed Substitution

Use sed s/find/replace/flags for in-place text substitution across files.

02
sed Line Operations

Delete, insert, and append lines using sed d, i, a commands.

03
awk Basics

Process structured text by field with awk, using -F for custom delimiters.

04
awk Patterns & Actions

Write awk programs with pattern/action pairs for conditional processing.

Challenges Encountered

  • sed -i behaves differently on macOS vs GNU sed
  • awk field separator must be set correctly for CSV with spaces

Key Takeaways

  • sed is for stream editing; awk is for structured data processing
  • awk is effectively a small programming language