Fun Shell Tricks

1.Print the 10 most frequent words in the input.

1
cat * | tr -sc A-Za-z '\n' | sort | uniq -c | sort -n | tail

Sadly this is not totally correct, it will give out something like:

1
2
22 pl
38 d

which are not exactly words.

2.use awk with substr:

1
date | awk '{print substr($4, 1, 5)}'