generated from mwc/lab_pipes
63 lines
1.8 KiB
Markdown
63 lines
1.8 KiB
Markdown
# Exercises
|
|
|
|
Answer the following questions (or at least as many as you can figure out) in this document.
|
|
For all the questions, use the 100k words. Give your answer for each exercise, and
|
|
show the command you used to get it. Each question can be answered using a single Terminal
|
|
command, though you might need to use a number of pipes.
|
|
|
|
If you want to be really stylish, put your code inside of backticks like this:
|
|
|
|
`cat words_100k.txt | length | put 10 | equal | count`
|
|
|
|
## 1. What is the longest word?
|
|
|
|
antidisestablishmentarianism
|
|
`cat words_100k.txt | length | order`
|
|
|
|
|
|
## 2. How many words have two u's in a row?
|
|
|
|
16
|
|
` cat words_100k.txt | match "uu" | count`
|
|
|
|
## 3. How many words have the word "cat" in them?
|
|
|
|
893
|
|
`cat words_100k.txt | match "cat" | count`
|
|
|
|
## 4. How many words have all five vowels (aeiou)?
|
|
|
|
812
|
|
`cat words_100k.txt | match "a" | match "e" | match "i" | match "o" | match "u"| count`
|
|
|
|
|
|
## 5. Which words have two l's in a row, two m's in a row, and two t's in a row? (they don't have to be in that order)
|
|
|
|
0
|
|
`cat words_100k.txt | match "tt" | match "ll" | match "mm"`
|
|
|
|
## 6. How many words have sixteen or more letters?
|
|
|
|
16 16 responsibilities
|
|
16 18 telecommunications
|
|
`cat words_10k.txt | length | order | put 16 | lessthan 0 1 -e`
|
|
|
|
## 7. What's the most frequent 10-letter word?
|
|
|
|
zoomorphic (but its a tie?)
|
|
`cat words_100k.txt | length | match "10" | frequency | order`
|
|
|
|
## 8. What's the longest word which doesn't have any repeated letters?
|
|
|
|
13 salpingectomy
|
|
`cat words_100k.txt | length | unique 1 | length | equal 0 2 | order`
|
|
|
|
## 9. What's the longest word which only uses four different letters?
|
|
|
|
I am not quite there on this one:
|
|
`cat words_10k.txt | length | order | put 4 | equal 0 1 | unique 2 | length | lessthan 0 2`
|
|
|
|
## 10. If you rearrange the letters in "sidebar," what other words can you create?
|
|
|
|
|