Challenge - 5 Problems
Pipeline Pro
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this pipeline?
Consider a file
What is the output of this command?
fruits.txt with the following lines:apple banana apple orange banana banana
What is the output of this command?
cat fruits.txt | sort | uniq
Bash Scripting
cat fruits.txt | sort | uniq
Attempts:
2 left
💡 Hint
Think about what
sort and uniq do when combined.✗ Incorrect
The
sort command arranges lines alphabetically. Then uniq removes consecutive duplicate lines. So duplicates are removed after sorting, leaving one of each fruit.💻 Command Output
intermediate2:00remaining
What does this pipeline output?
Given a file
What is the output of:
colors.txt with:red blue red green blue blue
What is the output of:
cat colors.txt | uniq | sort
Bash Scripting
cat colors.txt | uniq | sort
Attempts:
2 left
💡 Hint
Remember that
uniq only removes adjacent duplicates.✗ Incorrect
The
uniq command removes only consecutive duplicates, so the first uniq keeps the first 'red' and removes the second only if adjacent. Then sort arranges lines alphabetically.📝 Syntax
advanced2:00remaining
Which pipeline correctly counts unique lines ignoring case?
You want to count how many unique lines are in
data.txt, ignoring case differences. Which command pipeline does this correctly?Attempts:
2 left
💡 Hint
Check which commands support case-insensitive options and how they affect sorting and uniqueness.
✗ Incorrect
sort -f sorts ignoring case, grouping lines that match ignoring case together. uniq -i then removes consecutive duplicates ignoring case. wc -l counts the remaining unique lines ignoring case.🔧 Debug
advanced2:00remaining
Why does this pipeline not remove all duplicates?
You run this command:
But you notice duplicates remain in the output. Why?
cat list.txt | uniq | sort
But you notice duplicates remain in the output. Why?
Attempts:
2 left
💡 Hint
Think about the order of commands and how
uniq works.✗ Incorrect
uniq only removes duplicates if they are next to each other. Since sorting happens after uniq, duplicates may be separated and not removed.🚀 Application
expert3:00remaining
How to find the top 3 most frequent words in a file?
You have a file
words.txt with many words, one per line. You want to find the top 3 most frequent words along with their counts. Which pipeline achieves this?Attempts:
2 left
💡 Hint
Count duplicates after sorting, then sort counts numerically in reverse order.
✗ Incorrect
First,
sort groups identical words together. Then uniq -c counts occurrences. Next, sort -nr sorts by count descending. Finally, head -3 shows top 3.