Files
lab_pipes/exercises.md
angelotr ac65cd1ac5 In this assignment I fixed pipeline commands to correctly filter, count, and organize words while fixing errors that I might come across.
I thought this lab was really cool. From Unit 1 it felt different because I was working with using commands such as cat and using the straight line which was
totally different from before. The codes from Unit 1 compared to Unit 2 look completely different and more intimadating. In terms of learning, this kind of thinking
felt fimiliar becuase I took computing courses that lookk familiar. The way I used terminal felt so different compared to Unit 1 because for Unit 1 it seemed
to be more straight torward whereas so far in Unit 2 it has all these other commands seperated with the '|' symbol. Working on this lab made me realize how cool it
was to use code to find specific words with specific requirments rather than looking one at a time. I got stuck on the last 3 problems of the exercise and what I
did to get unstuck is I messaged one of the students and asked for help. I have just now started getting help from my peers because I have some in my in-person classes
so it makes it easier to comunication about the lessons.
2025-10-01 16:42:39 -04:00

71 lines
2.1 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?
`cat words_100k.txt | length | order -r | head -n 1`
The longest word is 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 the word "cat" in them`
## 4. How many words have all five vowels (aeiou)?
`cat words_100k.txt | match "a" | match "e" | match "i" | match "o" | match "u" | count`
812 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"`
bookkeeper, bookkeepers, and bookkeeping
## 6. How many words have sixteen or more letters?
`cat words_100k.txt | length | put 16 | lessthan -e | count`
696 words have sixteen 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 -n 1`
The most frequent 10-letter word is government
## 8. What's the longest word which doesn't have any repeated letters?
`cat words_100k.txt | unique | length 1 | length 1 | equal | order | tail -n 1`
salpingectomy
## 9. What's the longest word which only uses four different letters?
`cat words_100k.txt | unique | length 0 | put 4 | equal | pluck 3 | length | order | tail -n 1`
senselessness
## 10. If you rearrange the letters in "sidebar," what other words can you create?
`cat words_100k.txt | match "^(?=[abdeirs]{7}$)(?=.*a)(?=.*b)(?=.*d)(?=.*e)(?=.*i)(?=.*r)(?=.*s)"`
braised
seabird
sidebar