Skip to main content
3 of 4
grep and awk solution, instead of all that nonsense before!

grep and awk, 68 bytes

The script:

echo $(grep -o '[A-Za-z0-9_]*'|awk '!x[tolower(substr($0,1,1))]++')

Explanation:

  • grep -o matches the legal words, printing each on its own line.

  • awk takes the first letter of each line with substr, makes it lowercase, and then increments a hashtable entry with that key. If the value was 0 before the increment, the line is printed.

  • echo $(...) turns the lines back into words

I previously tried to create a solution without awk, using uniq, sort, grep and bash but fell just short. History in the edits.