Top 20 of words in my Go code
I wanted to find out the most popular words in my Go code, so I have decided to use the UNIX shell to do so.
$ find dir -name "*.go" -exec cat {} \; | tr ' ' '\n' | sed '/^$/d' | sed 's/[ \t]*//' | sed 's/ //g' | sort | uniq -c | sort -rn | head -20
At the time of writing this, the output of the previous command was the following:
1815 {
1368 :=
831 }
628 err
608 }
573 =
552 func
488 if
434 nil
368 !=
298 package
298 import
295 )
292 (
290 main()
290 main
284 "fmt"
267 ==
251 }
241 for
So, the most popular word is err
, which makes perfect sense! Then it was func
, if
, nil
as well as package
and import
.
After that I used Excel to make a simple graph.