api: "YAML JSON TOON Database"
version: "1.0.0"
format: "json"
dataset:
  slug: "awk-reference"
  title: "AWK Reference"
  description: "Essential AWK commands, built-in variables, and common patterns."
  category: "Unix Commands"
  category_slug: "unix-commands"
  tags: "unix,awk,text-processing,scripting"
  view_count: 0
data:
  - pattern: "Print columns"
    command: "awk '{print $1, $3}'"
    description: "Print the 1st and 3rd fields of each line."
  - pattern: "Field separator"
    command: "awk -F: '{print $1}' /etc/passwd"
    description: "Use colon as delimiter; print 1st field."
  - pattern: "Built-in variables"
    command: "NR, NF, FS, OFS, RS, ORS, FILENAME"
    description: "NR=record number, NF=field count, FS=OFS=field sep, RS=record sep."
  - pattern: "Conditional print"
    command: "awk '$3 > 100 {print $1}'"
    description: "Print $1 only when $3 exceeds 100."
  - pattern: "Sum a column"
    command: "awk '{sum += $2} END {print sum}'"
    description: "Accumulate sum of column 2 and print at END."
  - pattern: "Pattern matching"
    command: "awk '/error/ {print}' log.txt"
    description: "Print lines matching the regex /error/."
  - pattern: "Functions"
    command: "length(), sub(), gsub(), split(), systime()"
    description: "Built-in string and time functions."
  - pattern: "Multi-character FS"
    command: "awk -v FS=\"\\t\" '{print $2}'"
    description: "Set field separator to tab using -v flag."
