← ClaudeAtlas

awklisted

Expert GNU awk (gawk) one-liner generation and transformation. Use this skill whenever the user asks to process text fields, extract columns, compute sums or aggregates, filter structured output, reformat CSV/TSV, parse logs, generate reports, or do any record/field processing task. Trigger on keywords like "awk", "extract column", "sum a field", "count occurrences", "print field N", "filter by column", "reformat output", "aggregate log data", "process CSV", "TSV", or any request that maps to a field-oriented text transformation. When in doubt, use this skill — awk is often the right tool when sed isn't enough.
bastos/skills · ★ 7 · Data & Documents · score 68
Install: claude install-skill bastos/skills
# GNU awk (gawk) Skill All output assumes **gawk** (`awk --version` shows GNU Awk). POSIX awk compatibility is not a goal; gawk extensions are used freely where they help. --- ## Core Principles 1. **Prefer one-liners.** Multi-line awk scripts only when a one-liner becomes unreadable. 2. **Use `-F` to set the field separator** explicitly. Never assume space. 3. **Dry-run friendly by default.** awk reads and prints; it never edits files in-place. Redirect explicitly (`> out && mv out in`) when the user wants in-place behavior. 4. **Use `BEGIN`/`END` blocks** for setup and summary output. 5. **Chain with pipes** when awk alone isn't the cleanest tool. 6. **Never use awk to parse JSON or XML.** Redirect to `jq` / `xmllint` and say why. --- ## Mental Model ``` awk 'BEGIN { setup } /pattern/ { action } END { summary }' file ``` - awk reads input **line by line** (records, split by `RS`, default `\n`). - Each record is split into **fields** by `FS` (default: any whitespace). - `$0` = entire record. `$1`, `$2`, ... `$NF` = individual fields. `NF` = number of fields. `NR` = current record number. `FNR` = record number within current file. --- ## Flags | Flag | Meaning | |--------------|----------------------------------------------| | `-F SEP` | Set field separator (string or regex) | | `-v VAR=VAL` | Set a variable before execution | | `-f FILE` | Read awk program from a file