@gumnos

Whoa, that's some #awk alphabet soup.

I'm gonna need to learn awk next, ain't I? XD

I actually started out doing it all in grep (pipe the words in the file to grep -vixfF /usr/share/dict/words, but it was actually twice as fast to do a positive grep per input word than one big negative grep.

I'm actually already removing duplicates via an awk command that I copypastad from the internet, but I'll play with your example, thanks! :D

@rl_dane yowzer, that grep-per-source-word is likely where your slowneess resides. You can abuse #awk a bit like

awk -F'[^[:alpha:]][^[:alpha:]]*' 'NR==FNR{d[$1]; next}{for (i=1; i<=NF; i++) if ($i && ! ($i in d)) {print $i; ++t}} END{exit (t>255 ? 255 : t) + 0}' /usr/share/dict/words your_file_to_spellcheck.txt

to read the dictionary once into a hash-map, then iterate over the lines+words in your file to see if any words are not present in the dictionary with O(1) lookup-time-per-word rather than O(N) lookup ☺

No-no-no-no-no.

I already have more pet projects on my plate than I can currently handle, and too little time to entertain them all.

I do not have the time to write an adventure-game in #awk navigated as #gopher pages served by #inetd 😑

I'm reviving my #gopher project. It initially died in the early stages because @SDF wouldn't allow me to run #commonLisp in my .../cgi-bin. I've recently discovered that I can run #awk there, so I'm building a minimal DSL in awk and building it with that.

@linuxgal

For a pure #awk one-liner:

$ awk '{for (i=1;i<=NF;i++) if ((w=tolower($i)) ~ /^[a-z]{4}$/) ++a[w]}END{for (w in a) print a[w], w}' kjv.txt

That provides the frequencies too, but adjust the END block as you see fit 🙂

Print all the four letter words in the Bible with #awk and #perl

cat kjv.txt | perl -ne 'print map("$_\n", m/\w+/g);' | tr A-Z a-z | sort | uniq | awk 'length($1) == 4 {printf "%s ", $0}'

Awk’s codebase hit a record high at 37.6 M (up from 33.5 M) even as its contributor count dipped from 857 to 793. #Awk #github
@finner I invite you to share questions if you have 'em…some of us love #awk and enjoy a good challenge 😁
Dude. Wtf. I was just looking at the #awk guide and I now know like 0.00001% of awk and in like 2 seconds I just figured out how to do something I failed to do after more than an hour attempting with grep.
@finner everytime someone starts to learn #awk @bcantrill gets a diet coke