Skip to content

fix(builtins): improve AWK, jq, sed, and subshell capabilities#191

Closed
chaliy wants to merge 1 commit intomainfrom
claude/implement-pr-fixes-xHZcm
Closed

fix(builtins): improve AWK, jq, sed, and subshell capabilities#191
chaliy wants to merge 1 commit intomainfrom
claude/implement-pr-fixes-xHZcm

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Feb 10, 2026

Summary

  • AWK: Add match(), gensub(), power operator (^/**), printf width/format specifiers (%5s, %x, %o, %c), fix -F'\t' escape handling, fix as_bool for numeric strings, add exit with code, $0 modification with re-split
  • jq: Replace line-by-line JSON parsing with streaming deserializer to handle multi-line pretty-printed JSON
  • sed: Fix & replacement ambiguity, add \n/\t escapes in replacement, unskip pattern range addressing
  • Subshell redirection: Parse and apply redirections after compound commands ((cmd) > file)

Test plan

  • All 926+ unit tests pass
  • cargo fmt --check clean
  • cargo clippy --all-targets --all-features -- -D warnings clean
  • 14 spec tests unskipped and passing (AWK: 12, sed: 5, bash: 1)
  • AWK spec tests: power, printf formats, tab separator, negation, match, gensub, exit, ORS, $0 mod
  • sed spec tests: ampersand replacement, newline in replacement, pattern ranges
  • bash spec tests: subshell with output redirection

AWK improvements:
- Add match() function with RSTART/RLENGTH support
- Add gensub() function for global/nth substitution
- Add power operator ^ and ** support
- Fix printf width specifiers (%5s, %-20s, %05d) and add %x, %o, %c
- Fix -F'\t' escape sequence handling for tab delimiters
- Fix as_bool for numeric strings (enables !$1 patterns)
- Add exit statement with code support
- Add $0 modification with field re-splitting
- Process escape sequences (\n, \t) in format strings

jq improvements:
- Replace line-by-line JSON parsing with streaming deserializer
- Properly handle multi-line pretty-printed JSON input
- Works for both regular and slurp (-s) modes

sed improvements:
- Fix ampersand (&) replacement using ${0} to avoid regex ambiguity
- Add \n and \t escape handling in replacement strings
- Unskip pattern range addressing tests (/start/,/end/)

Subshell output redirection:
- Add redirect support to Command::Compound AST node
- Parse trailing redirections (>, >>, 2>, etc.) after ), }, fi, done
- Apply redirections when executing compound commands

Unskipped 14 spec tests across AWK and sed.

https://claude.ai/code/session_014b3FmJKqDyhYrisYnGC2M9
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@chaliy
Copy link
Contributor Author

chaliy commented Feb 10, 2026

Splitting into per-fix PRs as requested.

@chaliy chaliy closed this Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants