Files
lab_pipes/exercises.md
caglazir 7c08a272b5 I answered all questions except #5 and created
their respective files in addition to the exercises file which contains the single line code that creates the answer

-How did this lab feel different:
This lab didn't feel much different except for having to actually do
a lot more mental "sorting" of the commands.

-Terminal
I emjoyed this module. It actually was fun to do the exercises and
thinking of words in an unusual way like this. One thing I tried to do
was using strings for the "put" command, which didn't work. I tried to
use this with the "sidebar" question. I wanted to put the unique letters
and use the "equal" command with what the "unique" command puts out.

-Stuck
I got stuck on the vowel question and wasn't able to figure it out. I tried
to think more on it however I think my head is a bit too full to figure it out
at the moment so I left it for now. I tried to run some different combination
of commands to see where I could go but didn't really get anywhere.

-Help
My group didn't really talk this week. Ilma asked a question on how to submit our
work but I hadn't started yet  by the time she figured it out. I am
trying to get things done when I can which doesn't necessarily align with
when other people work on our assignments. Janattun did also ask how to
submit the work and I responded when I finished my work.
2025-09-28 15:04:07 -04:00

1.9 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 -r | head -n 1

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

cat words_100k.txt | match "oo" | count

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

cat words_100k.txt | match "cat" | count

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

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.*" cat words_100k.txt | match "oo.*" cat words_100k.txt | match "kk.*"

for all matches combined:

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

6. How many words have sixteen or more letters?

cat words_100k.txt | length | order -r | put 16 | lessthan 0 1 -e | count

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

cat words_100k.txt | length | order | put 10 | equal | frequency | order -r | head -n 1

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

cat words_100k.txt | length | order -r | unique 1 | length | equal 0 2 | head -n 1

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

cat words_100k.txt | length | order -r | unique 1 | length | put 4 | equal 0 1 | head -n 1

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 1