Code
Simple Unix Tokenization Commands
\newline
1) tr \text{--}sc ’A\text{--}Za\text{--}z’ ’\backslash n’ < sh.txt \newline
2) tr \text{--}sc ’A\text{--}Za\text{--}z’ ’\backslash n’ < sh.txt | sort | uniq -c \newline
3) tr \text{--}sc ’A\text{--}Za\text{--}z’ ’\backslash n’ < sh.txt | tr A\text{--}Z a\text{--}z | sort | uniq \text{--}c \newline
4) tr \text{--}sc ’A\text{--}Za\text{--}z’ ’\backslash n’ < sh.txt | tr A\text{--}Z a\text{--}z | sort | uniq \text{--}c | sort \text{--}n \text{--}r \newline
\newline
Where in each additional step: \newline
1) Words are tokenized per\text{--}line \newline
2) Sorts words alphabetically, displays instance counts \newline
3) Collapses uppercase letters to lowercase \newline
4) Sorts by frequency$$
0
1
Updated 2021-09-19
Tags
Data Science