Skip to content
Guest
Learn Linux · Course Syllabus Show lessons
Automation · 8 min read · Beginner

Text Processing with sed & awk

Transform text streams on the fly with sed substitutions and extract/sum columns effortlessly with awk.

What you'll learn

  • Perform global text substitutions using sed 's/old/new/g'
  • Extract and aggregate whitespace- or comma-delimited columns using awk
  • Combine grep, sed, and awk into clean one-line pipelines
  • sed (stream editor) excels at line-by-line search and replace (sed 's/http:/https:/g').
  • awk excels at structured columns ($1, $2, $NF) and quick numeric totals (awk '{sum += $2} END {print sum}').

Fill-in-the-Blank Exercise

Global Replace with sed

Replace every occurrence of http:// with https:// across all lines.

 's|http://|https://|' urls.txt

Live Bash Lab

Bashsed_awk.sh
Expected OutputClick “Run Live” to compile with GNU Bash
Total lessons: 48
https://devpath.jpsoriano.dev

Check Your Understanding

Score: 0 / 1

1. In awk '{print $2}', what does $2 refer to?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind