Project: Text and Log CLI Tools

Updated

September 8, 2026

Project: Text and Log CLI Tools

Overview

textkit: small pipeline tools—stdlib only—for daily log/text work.

Cmd Behavior
freq word/line frequency counts
cut -f fields -d delim
ts prefix lines with RFC3339 timestamp
sample keep every Nth line or rate %
jsonl-keys list keys seen in NDJSON

Contracts

  • stdin if no files
  • data stdout / errors stderr
  • exit 0 if IO ok

freq core

sc := bufio.NewScanner(r)
counts := map[string]int{}
for sc.Scan() {
    for _, w := range strings.Fields(sc.Text()) {
        counts[w]++
    }
}
// print sorted by count desc

ts

fmt.Fprintf(w, "%s %s\n", time.Now().Format(time.RFC3339), line)

Acceptance

printf 'a b\na\n' | go run . freq
echo hello | go run . ts