24 lines
327 B
Awk
24 lines
327 B
Awk
|
|
#!/usr/bin/awk -f
|
||
|
|
|
||
|
|
#
|
||
|
|
# Sort the indices as strings in ascending order
|
||
|
|
#
|
||
|
|
BEGIN{
|
||
|
|
PROCINFO["sorted_in"]="@ind_str_asc"
|
||
|
|
}
|
||
|
|
|
||
|
|
#
|
||
|
|
# Make a frequency table of the first letter of each word
|
||
|
|
#
|
||
|
|
{
|
||
|
|
freq[substr($1,1,1)]++
|
||
|
|
}
|
||
|
|
|
||
|
|
#
|
||
|
|
# Print the results in the frequency table
|
||
|
|
#
|
||
|
|
END{
|
||
|
|
for (i in freq)
|
||
|
|
printf "%s: %d\n",i,freq[i]
|
||
|
|
}
|