Skip to content

Instantly share code, notes, and snippets.

@hexpunk
Created March 1, 2022 03:54
Show Gist options
  • Save hexpunk/2049cffce5b2243c2f2ab2d57a91ef2d to your computer and use it in GitHub Desktop.
Save hexpunk/2049cffce5b2243c2f2ab2d57a91ef2d to your computer and use it in GitHub Desktop.
Awk script to assist in consonant-vowel frequency analysis
#!/bin/awk -f
# Converts words into consonant-vowel patterns
# Combine output with `sort | uniq -c | sort -rg` to list most to least common
{
split(tolower($1), chars, "")
for (i in chars) {
char = chars[i]
if (char ~ /[aeiou]/) {
printf("v")
} else {
printf("c")
}
}
printf("\n")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment