Files
lab_pipes/exercises.md
tsmith37 439e073b9e creating a new words_100k file and answer 10 questions
In this lab, there wasn't drawing but more on how to pull information from the Terminal.
It was harder to tell if I was putting in the right code because I didn't know what the outcome
should look like in a way. I got stuck on the last 4 questions, and I overcame them by talking
to my classmates and teachers.
2025-10-02 15:37:32 -04:00

2.1 KiB

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?

cat words_100k.txt | length | order

28 antidisestablishmentarianism

2. How many words have two u's in a row?

cat words_100k.txt | match "uu" | count

16 words have two u's in a row

3. How many words have the word "cat" in them?

cat words_100k.txt | match "cat" | count

893 words have cat in it

4. How many words have all five vowels (aeiou)?

cat words_100k.txt | match "a.*e.*i.*o.*u" | count

8 words have all five vowels

5. Which words have two e's in a row, two o's in a row, and two k's in a row? (they don't have to be in that order)

cat words_100k.txt | match "ee" | match "oo" | match "kk" | count

3 words had all of them

6. How many words have sixteen or more letters?

cat words_100k.txt | length | put 16 | lessthan -e | count

696 words have 16 or more letters

7. What's the most frequent 10-letter word?

cat words_100k.txt | length | put 10 | equal | pluck 2 | frequency | order -r | head

government is used 372000 times

8. What's the longest word which doesn't have any repeated letters?

cat words_100k.txt | length | order | unique 1 | length | equal 0 2

unpredictably, copyrightable, unproblematic, troublemaking, salpingectomy

9. What's the longest word which only uses four different letters?

cat words_100k.txt | length | order | unique 1 | length | put 4 | equal 0 1 | tail

senselessness

10. If you rearrange the letters in "sidebar," what other words can you create?

cat words_100k.txt | match ".*s" | match ".*i" | match ".*d" | match ".*e" | match ".*b" | match ".*a" | match ".*r" | length | put 7 | equal 0

braised, seabird