Created
April 17, 2026 23:30
-
-
Save dotysan/6651c0a14bbeaddc18f7b91ed8ca7fd8 to your computer and use it in GitHub Desktop.
The Rust AWK (rawk) fails to dedupe in some cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env bash | |
| # | |
| # The Rust AWK (rawk) fails to dedupe in some cases. | |
| # https://github.com/stefanalfbo/rawk/issues/19 | |
| # | |
| INPUT=$(< test-input.txt) | |
| PROG=' | |
| $1 !=prev { | |
| prev= $1 | |
| } | |
| ' | |
| main() { | |
| gawk_dedupe_stdin # success | |
| #rawk_dedupe_stdin # FAIL!/hang... | |
| gawk_dedupe_redir # success | |
| #rawk_dedupe_redir # FAIL!/hang... | |
| gawk_dedupe_here_doc # success | |
| #rawk_dedupe_here_doc # FAIL!/hang... | |
| gawk_dedupe_here_str # success | |
| #rawk_dedupe_here_str # FAIL!/hang... | |
| gawk_dedupe_file # success | |
| rawk_dedupe_file # success | |
| gawk_dedupe_subst # success | |
| rawk_dedupe_subst # success | |
| } | |
| gawk_dedupe_stdin() { | |
| echo 'gawk reading from stdin:' | |
| echo "$INPUT" | | |
| gawk "$PROG" | |
| } | |
| rawk_dedupe_stdin() { | |
| echo 'rawk reading from stdin:' | |
| echo "$INPUT" | | |
| rawk "$PROG" | |
| } | |
| gawk_dedupe_redir() { | |
| echo 'gawk reading from a redirected file:' | |
| gawk "$PROG" <test-input.txt | |
| } | |
| rawk_dedupe_redir() { | |
| echo 'rawk reading from a redirected file:' | |
| rawk "$PROG" <test-input.txt | |
| } | |
| gawk_dedupe_here_doc() { | |
| echo 'gawk reading from here doc:' | |
| gawk "$PROG" <<-EOF | |
| $INPUT | |
| EOF | |
| } | |
| rawk_dedupe_here_doc() { | |
| echo 'rawk reading from here doc:' | |
| rawk "$PROG" <<-EOF | |
| $INPUT | |
| EOF | |
| } | |
| gawk_dedupe_here_str() { | |
| echo 'gawk reading from here string:' | |
| gawk "$PROG" <<<"$INPUT" | |
| } | |
| rawk_dedupe_here_str() { | |
| echo 'rawk reading from here string:' | |
| rawk "$PROG" <<<"$INPUT" | |
| } | |
| gawk_dedupe_file() { | |
| echo 'gawk reading from a file:' | |
| gawk "$PROG" test-input.txt | |
| } | |
| rawk_dedupe_file() { | |
| echo 'rawk reading from a file:' | |
| rawk "$PROG" test-input.txt | |
| } | |
| gawk_dedupe_subst() { | |
| echo 'gawk reading from process substitution:' | |
| gawk "$PROG" <(< test-input.txt) | |
| } | |
| rawk_dedupe_subst() { | |
| echo 'rawk reading from process substitution:' | |
| rawk "$PROG" <(< test-input.txt) | |
| } | |
| main | |
| exit $? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1 | |
| 2 | |
| 2 | |
| 3 | |
| 3 | |
| 3 | |
| 4 | |
| 4 | |
| 4 | |
| 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment