Advanced Shell & Text Processing
Process text with regular expressions, sed and awk, write Bash that uses expansions and arrays safely, debug and port scripts, and work fluently in a shell on remote servers.
5 objectives 6 steps about 150 min
Learn it step by step
Read the lessons in order, try the practice checks, then prove the skill with the knowledge check.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Write basic and extended regular expressions and use grep -E, sed and awk to filter, extract, transform and summarise log and CSV data.
- Use Bash expansions and data structures - parameter expansion for defaults, substrings, pattern replacement and case conversion, brace, arithmetic and pathname expansion, indexed and associative arrays, here-documents, here-strings and process substitution - in working scripts.
- Trace and debug scripts with set -x, PS4 and bash -n, read input safely with read and format output with printf, and identify Bash-only syntax that breaks under POSIX sh (dash).
- Manage long-running work with job control (jobs, fg, bg, disown), nohup and tmux, and explain how SIGHUP and process groups decide what survives a logout.
- Edit configuration files on a remote server with vim or nano and sudoedit, and configure the interactive shell with startup files, aliases, history search and completion.
Lesson plan
6 steps, about 150 min · 5 of 5 lessons available so far
- Patterns that travel: regular expressions in grep, sed and awk Concept · 25 min
- Lab: from a raw access log to a report with grep, sed and awk Lab · 30 min
- Bash beyond the basics: expansions, arrays, here-documents and process substitution Worked example · 25 min
- When a script misbehaves: tracing, syntax checks, safe input and portability to dash Worked example · 20 min
- Lab: living on a remote server - editors, sudoedit, startup files, job control and tmux Lab · 30 min
- Check: shell fluency tasks and a log-report script to repair Knowledge check · 10 questions
Practise it
Write logreport.sh: from a directory of compressed web-server logs it prints requests per status code per hour, the ten busiest client addresses and the slowest endpoints, using grep -E, sed and awk with associative arrays, options with defaults from parameter expansion and a help text from a here-document; it must pass ShellCheck and bash -n, and you run it inside tmux on a remote VM, disconnect and collect the result later. Submit the script, a set -x trace of one run and the report.
Build it from scratch
Practice builds that exercise this skill by re-creating a real technology.
- Build your own ShellIntermediate · 8–16 h
References
Hard prerequisites
Unlocks
Nothing depends on this skill yet.
On these roadmaps
Progress and evidence for this skill are shared across all of them.