RosettaCodeData/Task/Word-frequency/UNIX-Shell/word-frequency-1.sh

3 lines
100 B
Bash

#!/bin/sh
<"$1" tr -cs A-Za-z '\n' | tr A-Z a-z | LC_ALL=C sort | uniq -c | sort -rn | head -n "$2"