More in Text Processing
Sort and deduplicate lines by a field
Text Processing
Sorts on the second column and keeps the first row of each group.
Extract matches with a regular expression
Text Processing
grep -o prints only the matching part, which turns grep into a crude extractor.
Sum a column with awk
Text Processing
Adds the third field of every line and prints the total, ignoring anything non-numeric.
Rewrite a CSV column with perl
Text Processing
A one-liner that upper-cases the second field of every row, leaving the rest alone.
Pretty-print and query JSON
Text Processing
jq for the common cases: reformat, pick a path, filter an array, and reshape.
A regular expression for ISO 8601 dates
Text Processing
Matches a date, optionally with a time and a zone. Deliberately strict about separators.
Random picks
Worker pool with a wait group in Go
Systems
Fixed number of goroutines draining a channel, with the group ensuring main waits for all of them.
Tail a log and colour only what matters
Shell
Follows a growing file and highlights errors and warnings, leaving the rest readable but quiet.
Shell into a running container
Containers
Falls back to sh, since slim images often have no bash.
Find the commit that introduced a bug
Git
Binary search across history. Mark a known good and a known bad commit and git narrows it down for you.
Time every phase of an HTTP request
Networking
Splits DNS, connect, TLS and first byte apart, which tells you which one is actually slow.
Find what is taking up space in an image
Containers
Prints the size each layer adds, which usually points straight at the offending RUN line.
Call a JSON API from PowerShell
Networking
Invoke-RestMethod parses the response for you, so no ConvertFrom-Json step is needed.
Walk a directory tree lazily
Python
pathlib keeps the paths as objects rather than strings, so joining and suffix checks stay readable.