News for hackers. Stuff that matters.
Re:Bash one-liner to produce a list of HEX color codes that ... by ratsmack on Saturday October 01, 2022 @05:45PM (#33050431)
I don't like using multiple commands.

    mawk 'BEGIN{b = "[abcdefois]"; l = "[a-z]"; W = "^" b l l l l l "$"}; $0 ~ W {print "#" toupper($0);}' /usr/share/dict/words
Re:Bash one-liner to produce a list of HEX color codes that ... by kbr2000 on Saturday October 01, 2022 @05:54PM (#33050491)
I came up with:

  gawk 'BEGIN {IGNORECASE=1} ((length($1) == 6) && /^[a-fois]+$/) {gsub(/o/,0);gsub(/i/,1);gsub(/s/,5); print toupper("#"$1)}' /usr/share/dict/words
(caveat: it does not filter out duplicates)
Re:Bash one-liner to produce a list of HEX color codes that ... by adrianmonk on Saturday October 01, 2022 @07:05PM (#33051008)
You can also do it entirely in sed:

    sed -E -e '/^[a-fio]{6}$/!d; y/abcdefioIO/ABCDEF1010/; s/^/#/' /usr/share/dict/words
Re:Bash one-liner to produce a list of HEX color codes that ... by xertopertha on Sunday October 02, 2022 @08:44AM (#33055446)
This produces 35 items. The grep version gives 93
Re:Bash one-liner to produce a list of HEX color codes that ... by adrianmonk on Sunday October 02, 2022 @11:17AM (#33056624)
Yeah, I failed to make the pattern case insensitive.

Here's a fixed version that also handles S/5:

    sed -E -e '/^[A-FIOSa-fios]{6}$/!d; y/abcdefiosIOS/ABCDEF105105/; s/^/#/' /usr/share/dict/words
Re:Bash one-liner to produce a list of HEX color codes that ... by Keyframe on Saturday October 01, 2022 @05:49PM (#33050456)
you also aren't going to get valid color codes