Learn › Linux Foundations
Text Processing
Transform, filter, sort, and reshape text from the command line. Master the core text-processing toolkit that makes Linux powerful for data manipulation, log analysis, and automation.
Labs in this module
- printf - Print exactly the output you describe with printf: the %s, %d, and %f placeholders, the \n and \t escapes, field width and justify with %5s
- tr - Translate, delete, and squeeze characters with tr: map a-z to A-Z, strip a set with -d, collapse repeats with -s, and keep only what you nam
- grep - Search text with grep: print the lines that match a word, then the flags an engineer reaches for. Count with -c, number with -n, ignore case
- cut - Slice a column out of every line with cut: fields by delimiter using -d and -f, characters by position with -c, the four list forms (N, N,M,
- sort - Put lines in order with sort: the lexical default, -r to reverse, -u for sorted-and-unique, and -n to fix the classic trap where 10 sorts be
- uniq - Collapse repeated lines with uniq. The one rule that trips everyone: uniq only compares adjacent lines, so you sort first. Count with -c, sp
- paste - Merge files side by side with paste, the horizontal partner to cat. The default tab seam, a custom delimiter with -d, and folding one file o
- join - Stitch two files into one with join, matching lines on a shared key field. Learn the default field-1 match, the -1 and -2 key selectors, the
- comm - Compare two sorted lists with comm: three columns for only-in-first, only-in-second, and in-both. Suppress columns by number with -1, -2, -3
- diff - Compare two files line by line with diff. Read the normal report where < is the first file and is the second, learn the silence of identical
- patch - Ship a change, not a whole file. patch applies the record diff wrote: patch old < change.patch edits the file, patch -R undoes it, --dry-run
- column - Turn ragged, space-separated data into a clean aligned table with column. The -t table flag that does the aligning, -s to split on a colon,
- Regular Expressions - Describe SHAPES of text, not exact spellings, with regular expressions, practiced through grep -E. The dot, the ^ and $ anchors, the , +, an
- sed - Transform text line by line with sed, the stream editor. Substitute with s/OLD/NEW/, replace every match with the g flag, print one line wit
- awk - Read text as fields with awk: address columns as $1, $2, $0, use the comma in print to space them, and set the divider with -F. Meet the NR
- Signal Station: Operation Signal Extraction - The Text Processing module capstone mission. Drill grep, cut, sort, uniq, tr, sed, and awk in one hands-on operation over a real signal log